pyNetLogo icon indicating copy to clipboard operation
pyNetLogo copied to clipboard

Repeat Report cannot handle Reporters containing strings.

Open Wolgo opened this issue 4 years ago • 2 comments

https://github.com/quaquel/pyNetLogo/blob/b944208036c9ef7a9b0b31c8c890a05cdb73f98d/pyNetLogo/core.py#L573-L575

The problem is that the netlogo code here becomes: file-open "folder/count object where [ string = "value"].txt" Meaning netlogo understands:

file-open 
"folder/count object where [ string = " 
value
"].txt"

Due to netlogo requiring " for strings like file-open, there is no way to get around this by altering the reporter. My recommendation would be to simply remove all " from the variable for the filename.

(Possible: variable.replace('"',''))

Wolgo avatar Jul 20 '21 08:07 Wolgo

To further expand on this, on windows I think it's doesn't like the characters: < > either. I think the file name needs to be changed to avoid any special character that might cause problems.

Wolgo avatar Jul 20 '21 09:07 Wolgo

good point. Indeed, I implicitly assume that variable is some alphanumerical string so this needs fixing. In principle the use of the variable name in the name of the txt file is not needed at all. It can be any random string, as long as I maintain a mapping between the variable name and the associated txt file.

quaquel avatar Sep 09 '21 19:09 quaquel