ERROR: SystemError: close: Input/output error (related to CSV package)

I’m simulating some data sets (60 in total), where I loop over the same procedure 60 times, saving each data set as a CSV file before moving on to the next data set.

After doing this procedure 13 times (out of the 60), my code crashes with the following error:

ERROR: SystemError: close: Input/output error

I have attached a picture with the full error message. Specifically the error happens on line 269 in a function where I write the simulated data to a csv file using CSV.write (see same image).

I have no clue why I can run this procedure without faults 13 times before it then crashes. If I delete the generated csv files and start over, the code crashes at the exact same point.

Could it be a memory issue? Do I somehow have to properly ‘close’ each csv file after I am done writing to it?

Can’t seem to find the same error message anywhere online, so any help is appreciated.

Can you share some additional info on this?

Sharing the code (or some code that can help us reproduce this) might be the best way to arrive at a solution (or at least an explanation) for your issue.

eh, maybe don’t do this in oneDrive folder, I suspect sync is messing with you

2 Likes

Ah, yes this was indeed the issue. So simple.
Have used onedrive for back up in the past (required by the project I’m on for data storage) with no issues, but not actually sure if I used to save it directly to onedrive or or move it after, so didn’t even think of that being the issue.

Thanks a bunch!