Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files with comma in name are not properly escaped in output CSV #132

Open
subdavis opened this issue Mar 30, 2021 · 3 comments
Open

Files with comma in name are not properly escaped in output CSV #132

subdavis opened this issue Mar 30, 2021 · 3 comments
Labels

Comments

@subdavis
Copy link
Contributor

subdavis commented Mar 30, 2021

Caused https://viame.kitware.com/girder#job/606200e1667a04d5d4f8682f to fail.

Here's an example of the output from a file called 20171027_,_214855.865,02,9443.png

# 1: Detection or Track-id,  2: Video or Image Identifier,  3: Unique Frame Identifier,  4-7: Img-bbox(TL_x,TL_y,BR_x,BR_y),  8: Detection or Length Confidence,  9: Target Length (0 or -1 if invalid),  10-11+: Repeated Species, Confidence Pairs or Attributes
# Written on: Tue Mar 30 22:09:20 2021   by: write_detected_object_set_viame_csv
0,20171027_,_214855.865,02,9443.png,0,636.762,71.0875,712.387,189.062,0.998693,0,generic_object_proposal,0.998693
1,20171027_,_214855.865,02,9443.png,0,756.25,15.125,968,192.088,0.998171,0,generic_object_proposal,0.998171
2,20171027_,_214855.865,02,9443.png,0,766.837,4.5375,968,40.8375,0.968831,0,generic_object_proposal,0.968831
3,20171027_,_214855.865,02,9443.png,0,896.913,355.438,968,425.012,0.96825,0,generic_object_proposal,0.96825
4,20171027_,_214855.865,02,9443.png,0,898.425,251.075,968,350.9,0.929115,0,generic_object_proposal,0.929115
5,20171027_,_214855.865,02,9443.png,0,739.612,624.663,766.837,685.163,0.211674,0,generic_object_proposal,0.211674

DIVE could technically handle this by doing a name transform for inputs, but then they wouldn't match the input file name, which isn't ideal.

@subdavis subdavis added the bug label Mar 30, 2021
@russelldj
Copy link
Collaborator

We've been writing some somewhat brittle csv writers on the kwiver side. I was wondering if there are any library resources to help at least clean up cases like this. My guess is the "right" way to handle this is use quoting and have your reader and writer respect the same spec for it.

@subdavis
Copy link
Contributor Author

subdavis commented Jun 2, 2021

If you're using python, the regular csv module will do everything perfectly if you use the writer.write([array, of, column, values]) function.

@russelldj
Copy link
Collaborator

We haven't been but that seems like it might be a good option moving forward as the python support improves. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants