IOError: [Errno 2] No such file or directory: '{my_file_name}.csv'
**Hello,
First, I'd like to thank the makers of this amazing software. I can't believe something this great is also free!
I'm having an issue accessing my csv through OpenSesame. I have some randomly generated numbers coded with inline script and stored to the csv with a logger.
I want to be able to access the .csv with inline scripting. So far, I feel like my code is working, but I don't know how to tell it where to search. Here's an example of my code:**
import csv
csvname = "subject-" + str(var.subject_nr) + ".csv"
with open(csvname) as csvfile:
data = csv.reader(csvfile, delimiter=',', quotechar='"')
I get this in the debug window:
Error while executing inline script
item-stack: experiment[prepare].calculate_payment[prepare]
exception type: IOError
exception message: [Errno 2] No such file or directory: 'subject-0.csv'
item: calculate_payment
time: DDD MMM DD TT:TT:TT YYYY
phase: prepare
Traceback:
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\inline_script.py", line 81, in prepare
self.experiment.python_workspace._exec(self.cprepare)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\python_workspace.py", line 161, in _exec
exec(bytecode, self._globals)
File "", line 5, in
IOError: [Errno 2] No such file or directory: 'subject-0.csv'
Is there something I'm doing wrong? I'd like for it to read the csv file from the same directory as where my experiment is saved. THANK YOU!
Comments
Note: The example code isn't indented.
NEVERMIND I FIGURED IT OUT!