Processing.py-Bugs icon indicating copy to clipboard operation
Processing.py-Bugs copied to clipboard

can't import a file

Open andyWiles opened this issue 6 years ago • 1 comments

Hi !

With the file "villes.csv" copied in the folder data the following code doesn't work The error message is : processing.app.SketchException: IOError: (2, 'No such file or directory', 'villes.csv')

import csv 
file = open("villes.csv", "rb")
try:
    reader = csv.reader(file)
    for row in reader:
        print(row[1],row[5],row[6]) 
finally:
    file.close()

The file seems not able to be located by processing.py Do you have an idea ?

andyWiles avatar May 08 '19 13:05 andyWiles

My guess is that, because you're using Python's native open function, you don't get the magical auto-location of a data file; only the Processing built-ins do that sort of thing (createInput and createReader, etc.).

jdf avatar May 08 '19 13:05 jdf