#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

# IOError, Picture file does not exist (but it does)

Hi all,

My lab occasionally gets an error of the type IOError with the message "The picture file [name of file] does not exist." We get the error inconsistently and not that often in two different experiments. The one time I have been present to take a look, I opened the file pool inspector and there were no images in the pool. Then I closed and re-opened the experiment, and the pool was full again. Here is the full message from that incident. Thanks for any advice you have.

Stopped

The experiment did not finish normally for the following reason:

Unexpected error
Details

item-stack: experiment[run].TX[run].TX_sequ[prepare].CS[prepare]
exception type: IOError
exception message: The picture file 'face3.jpg' does not exist
time: Thu Nov 29 04:23:26 2018
Traceback (also in debug window)

  File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libqtopensesame\misc\process.py", line 157, in run
exp.run()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\experiment.py", line 456, in run
self.items.execute(self.var.start)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 103, in execute
self.run(name)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 122, in run
self[name].run()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\sequence.py", line 51, in run
self.experiment.items.run(_item)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 122, in run
self[name].run()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\loop.py", line 347, in run
self.experiment.items.execute(self._item)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 102, in execute
self.prepare(name)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 142, in prepare
self[name].prepare()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\sequence.py", line 124, in prepare
self.experiment.items.prepare(_item)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 142, in prepare
self[name].prepare()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\sketchpad.py", line 149, in prepare
temp_name, element.element_name
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\openexp\_canvas\canvas.py", line 354, in __exit__
self.prepare()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\openexp\_canvas\canvas.py", line 775, in prepare
element.prepare()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\openexp\_canvas\_image\xpyriment.py", line 31, in prepare
self._stim = Picture(filename=safe_decode(self.fname))
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\expyriment\stimuli\_picture.py", line 49, in __init__
unicode2byte(filename)))
IOError: The picture file 'face3.jpg' does not exist



• Can you reliably reproduce this error? This would be very useful. Otherwise it is hard to deal with this issue. Maybe it has to do with garbage collection or the pool is cleared out for some reason? But honestly, I am fishing in the dark here.

Eduard

• I'll take any advice I can get Thanks Eduard. I can't reliably reproduce the error. It happens in two different experiments unpredictably at a low frequency. I wasn't even going to post about it because it's rare and odd, but it happened just enough times for me to bring it to the community's attention. This might not be the garbage collection you have in mind, but we have cleared all the unused items (thanks to the update that allows you to do that quickly).

• edited February 8

Hi all,

This inexplicable IO error has been happening with more regularity in another experiment. In this case, we can see the file in the file pool that supposedly is not available (it's a disgust experiment, hence the image name).

Although I cannot reproduce the error reliably, there is some consistency: When it occurs, it always occurs in the last trial in a block of 16 trials (The "Trials" loop is called twice in the experiment; it happens on either the first or second call, always at the start of the final trial). Is that clue helpful?

We have a workaround for the crash, but any advice would be greatly appreciated.

Thanks,

## Tom

The experiment did not finish normally for the following reason:

Unexpected error
Details

item-stack: experiment[run].Trials[run].Trials_sequ[prepare].image_array[prepare]
exception type: IOError
exception message: The picture file 'Poop.jpg' does not exist
time: Fri Feb 08 12:51:32 2019
Traceback (also in debug window)

  File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libqtopensesame\misc\process.py", line 157, in run
exp.run()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\experiment.py", line 456, in run
self.items.execute(self.var.start)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 103, in execute
self.run(name)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 122, in run
self[name].run()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\sequence.py", line 51, in run
self.experiment.items.run(_item)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 122, in run
self[name].run()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\loop.py", line 347, in run
self.experiment.items.execute(self._item)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 102, in execute
self.prepare(name)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 142, in prepare
self[name].prepare()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\sequence.py", line 124, in prepare
self.experiment.items.prepare(_item)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 142, in prepare
self[name].prepare()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\sketchpad.py", line 149, in prepare
temp_name, element.element_name
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\openexp\_canvas\canvas.py", line 354, in __exit__
self.prepare()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\openexp\_canvas\canvas.py", line 775, in prepare
element.prepare()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\openexp\_canvas\_image\xpyriment.py", line 31, in prepare
self._stim = Picture(filename=safe_decode(self.fname))
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\expyriment\stimuli\_picture.py", line 49, in __init__
unicode2byte(filename)))
IOError: The picture file 'Poop.jpg' does not exist

• Independent of the actual images used? Can you use an inline_script either instead of before the sketchpad and check whether you can access the stimuli in that way?

Eduard

• Thanks for your reply. It seems to be independent of the actual image. Any thoughts on why it might happen in the last iteration of the loop? The 15 prior iterations involve presentation of the same two stimuli--poop.jpg and rock.jpg from the file pool. Only on the 16 iteration is there sometimes an IO error. It's the same images and the same sketchpad object in the loop for the other 15 iterations prior.

If you could give me a little more details on how to run the test you suggest, I would greatly appreciate it. Were you thinking something along the lines of the use of the canvas object in this link (in the section on using inline scripts to present images)?:
https://osdoc.cogsci.nl/3.2/manual/stimuli/visual/#presenting-visual-stimuli-in-python-inline-script

Thanks again for your help. I really appreciate it.

• I just confirmed that the error is independent of the actual image: It happens for either of the two images (Rock.jpg and Poop.jpg).

• Hi Tom,
You can use these examples to test inline_scripts: https://osdoc.cogsci.nl/3.2/manual/python/canvas/#function-canvas46image40fname-centertrue-xnone-ynone-scalenone-rotationnone41

Can you share the experiment? Just to check whether it also occurs on other systems. That said, can you test it on other computers you have available?

Eduard

• Thanks Eduard! I will try that out. Here is the experiment. We got the error on a different PC, prior to upgrading to the faster PC we are using now. But I will try to test on a different machine in our lab. I'll let you know how the test with the scripts go. The experiment file is attached. (We are now running a modified version of this experiment that allows us to resume at different points in the experiment after the error.)

• Hi Eduard,

I tried out that code. I edited the example by inserting one of my files in as the filename:

my_canvas = Canvas()
# Determine the absolute path:
path = exp.pool[u'Rock.jpg']
# Function interface
my_canvas.image(path)
# Element interface
my_canvas['my_image'] = Image(path)


I removed the slide object that previously displayed the image and replaced it with an inline script with the code. When I ran the experiment, there was a multi-second pause, but no image was displayed. Also, afterwards, when I typed:

path = exp.pool[u'Rock.jpg']


into the debugging window, it said exp.pool did not exist.

Also, I should add that if you are trying to test the experiment, you have to press 1 or 2 twice to get past the opening screen (this sets the condition). I will test the experiment on a different machine next. Please let me know if I got something wrong with the inline script test.