jdf / Processing.py-Bugs

A home for all bugs and feature requests about Python Mode for the Processing Development Environment.
41 stars 8 forks source link

can't import a file #271

Open andyWiles opened 5 years ago

andyWiles commented 5 years ago

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 ?

jdf commented 5 years ago

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.).