-
Notifications
You must be signed in to change notification settings - Fork 6
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
Importing a line containing \"
throws RuntimeException
#8
Comments
Also
|
The problem here is that the CSV parser is seeing the quote in
the parser matches the first One of the tough parts about CSV is that there isn't really any agreed upon standard. Besides people using all sorts of different delimiters, cell quotation practices, and so forth, how special characters are escaped varies as well. Unlike in many applications, escaping things like newlines and tab characters is not necessary, as you can just stick them in a quoted field. Quotation marks do need to be escaped however. As I understand it, most software that uses CSV escapes quote marks by putting two quote marks in a row (Excel is a notable example). So the above line would be written:
So here's the dilemma. I could specify As a workaround, you can replace instances of |
Hello Bryan, I just posted about a tool I wrote on StackOverflow.com that shows the I made a note in the readme file about the csv issue. As far as I'm You can see how where the embedded double quotes shows up, if you look That is actually code for two parts of the interface, plot setup and The other areas is in Pens, where NetLogo uses one line to store 7 I found using csv was way easier than trying to otherwise separate the If you can think of a way to break the strings into parts without using -- Doug Edmunds
|
Hi Doug, You can get pretty far using However, this fails when dealing with multiple pens as you don't know how many pens there are, so you don't know when to switch back to I'll keep thinking about it though. Sorry there isn't a simpler solution. |
My dirty solution to how many pens is that there is a blank line after On 9/7/2015 11:43 AM, Bryan Head wrote:
|
That works when reading everything with |
I developed some code similar to your suggestion of using the string extension's rex-replace-all procedure. I want the model to work 'straight out of the box', without requiring any extensions not already included with NetLogo 5.2. After running file-read-line, it now looks for the slash-doublequote in the string. If found, it substitutes "@@". Then it runs csv:from-row. Finally it substitutes back the slash-doublequote for any @@. To cover the bases, it tests for @@ in the original string. If found, it just reports the original string, without using csv:from-row. This avoids the runtime error problem, afaik. |
Reported by @dougedmunds in NetLogo/NetLogo#845. That bug has a more extensive example, but the following is sufficient to reproduce:
That is, attempting to parse the string
"\" \""
results in:The text was updated successfully, but these errors were encountered: