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

Comments

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

  • Hi Tom,


    Did you also show the canvas, i.e. calling my_canvas.show(). If not this is the reason why the screen stayed empty. Can you reupload your experiment, it seems that the upload has failed.

    Eduard

  • Hi Eduard,

    Here is the experiment (it's the actual experiment--not the test version with the inline script). The first screen allows you to start at different points in the experiment, depending on if and when it crashed. After that, you need to press 1 or 2 during the "loading experiment" screen to advance (that's condition assignment). Also it is setup for an Eye Tribe eye tracker, so it will crash if the PyGaze init isn't set to dummy.

    In terms of the test version, I added my_canvas.show() to the inline script, but I still don't get an image. In the debug window afterwards, I get this warning for each trial:

    Canvas.show() took 30.0 ms

    function not supported yet

    Thanks for your help,

    Tom

    PS I have also tried to reproduce the error on a the other machine in our lab, but haven't been able to, but I only tried a few times. The IO error did occur, although with less frequency, on a prior machine that we replaced (and in different experiments).

  • Hi Tom,

    Thanks for giving this elaborate test script. One thing that I noticed immediately is that the image files are capitalized incorrectly in the experiment. Specifically, Image_rate__3 refers to RealVAS.jpg, but the file is actually called RealVAS.JPG (i.e. the extension is uppercase). This will crash on operating systems that are case sensitive, such as Linux and Mac OS but not most (or all?) versions of Windows.

    So I would suggest to fix the capitalization first, so we know that it's not simply that. And then take it from there.

    Cheers!

    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • Thanks Sebastiaan! I will start there. We are using a PC with Windows 10.

  • Hi Sebastiaan and Edward,

    I fixed the file extension--from .JPG to .jpg--and there have been no IO errors for the last 19 participants! We used to get it ~1/5 participants, so I am pretty sure the problem is solved, but I will check back after we run another 20 or so. I wonder why the file extension for that scale would cause the IO error for a different image on a different trial....

    Thanks again for all of your help!

    Tom

  • edited April 5

    Of course the day after I post, the IO error comes back! We just got it twice for one participant. First, it happened where it often does, in the last trial of the first block of trials. Then, upon trying to start the experiment from the place it crashed, using the conditional runif statements for experiment objects, we got the IO error immediately for one of the scale images (we advance the experiment to a ratings procedure when it crashed at the end of the first block of trials). This sequence of IO errors has happened before, and in the past, we continued to get the IO error for the rating scale until we closed and restarted OpenSesame. So we did that, and then it ran fine (except we got the runtime error with Python crashing during calibration of the Eye Tribe, which we continue to get roughly 1/8 times. I have reported that elsewhere and tried updating libraries with no luck:


    Here are the tracebacks for the errors:

    First IO error in last trial of block:


    Stopped


    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 Apr 05 12:18:04 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

    ~~~


    second IO error in ratings after trial block:


    The experiment did not finish normally for the following reason:


    Unexpected error

    Details


    item-stack: experiment[prepare].Instr2[prepare]

    exception type: IOError

    exception message: The picture file 'EVS_Unipolar.bmp' does not exist

    time: Fri Apr 05 12:20:05 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 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 'EVS_Unipolar.bmp' does not exist

    ~~~


    Thanks for any advice you have, and again, I appreciate all of your help with this mysterious error.

    Tom

  • Hi,

    That's unfortunate. And strange too, because Poop.jpg is definitely in the file pool, and it's also spelled correctly in the experiment.

    One thing that comes to mind is that the temporary folder to which the file pool is extracted is removed for some reason, possibly by the operating system or some other software that's running in the background. If this is indeed the issue, then putting the image files in the experiment folder, rather than in the file pool, should solve it. Could you try this and let me know is this solves the error?

    Cheers!

    Sebastiaan

    Thanked by 1TomArmstrong

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • Thanks for the advice. I now have the images in a folder "__pool__" in the experiment folder. Just to make sure I follow: when you used the "__pool__" folder method, OpenSesame still copies the files to a temporary folder, as it would if you loaded the files into the pool through the experiment, right? But in the case of the pool folder method, the program has a backup in case the files aren't found in the temporary folder?

  • Hi Tom,

    > Just to make sure I follow: when you used the "__pool__" folder method, OpenSesame still copies the files to a temporary folder, as it would if you loaded the files into the pool through the experiment, right?

    Actually no. The __pool__ folder will stay where it is, but OpenSesame will automatically look for files in there, just like it will look in the regular file pool.

    Let me know if this solves the issue!

    Cheers,

    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • Ahh, I get it. So far so good after 3 participants. I'll let you know if we get another IO error. Thanks again!

Sign In or Register to comment.