Welcome!

Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

Supported by

Issues regarding Python crashing / pythonw.exe being unresponsive, and more..

cescocesco Posts: 14

I've been having a few issues with my experiment deciding to be funky. I use OpenSesame 3.1.6 with the PsychoPy backend and PyGaze for eye tracking with an SMI-Red500 on a dual-PC setup. The Pygaze scripts are running smoothly now, but the experiment won't complete.

The experiment is quite 'long' but shouldn't be too heavy in terms of processing. Across the experiment, there are two tasks and each task one of two conditions (between blocks). Consequently, there are quite a number of loops/sequences which run conditionally dependent on which level is set in the 'master' loop. Furthermore, each sequence contains a number of sketchpads which are followed by inline scripts to check for fixations to determine what will be presented on the next sketchpad.

I have tried this on two different computers, both running Windows. Each behaves differently, but the root of this appears to be similar.

Computer 1:
The experiment runs fine until a little over half way through. One of the following things happens first, and usually they follow each other.
A: My stimuli start to look like the attached image. To be clear: it's meant to be a face in the centre with one object on each side.
B: The screen greys out and Microsoft's blue spinning wheel makes an unwelcome appearance.

This seems to be a memory issue, as previously indicated by other users on this forum. Upon inspection, pythonw is not responding. Also, the task manager shows two instances running. The first one draws about 25% CPU and 446k of RAM; the second one 0%CPU (?) and 134k RAM (on a 4GB RAM machine).

Troubleshooting / clean up actions
* I had some unlinked logger items. Not completely sure if that makes a difference, but I got rid of them.
* Following a tip I found on this forum, I disable garbage collection and put a gb.collect() script at the end of each sequence.
* Some general decluttering.

All of this worked, as in it suspended the problem until later in the experiment.

Computer 2 (more RAM available):
Appears to run smoother, but I'm running into a psychopy problem (also previously reported by others on this forum). The experiment crashes in the second loop of the second task, usually about 10 out of 40 trials in and has to do with the text that should be presented on the screen (just two letters). Traceback:

Stopped

The experiment did not finish normally for the following reason:

Unexpected error
Details

item-stack: experiment[run].BlockLoop[run].BlockProc[run].Condition[run].Exp_sequence[run].CueingloopU[run].BlockSequence[run].Block_loop[run].CueingSequence[run].GC_target[run]
exception message: exception: access violation reading 0x00000010
time: Tue Jul 11 10:07:33 2017
exception type: WindowsError
Traceback (also in debug window)

  File "C:\OpenSesameC\lib\site-packages\libqtopensesame\misc\process.py", line 140, in run
    exp.run()
  File "C:\OpenSesameC\lib\site-packages\libopensesame\experiment.py", line 413, in run
    self.items.execute(self.var.start)
  File "C:\OpenSesameC\lib\site-packages\libopensesame\item_store.py", line 91, in execute
    self.run(name)
  File "C:\OpenSesameC\lib\site-packages\libopensesame\item_store.py", line 106, in run
    self[name].run()
  File "C:\OpenSesameC\lib\site-packages\libopensesame\sequence.py", line 51, in run
    self.experiment.items.run(_item)
  File "C:\OpenSesameC\lib\site-packages\libopensesame\item_store.py", line 106, in run
    self[name].run()
  File "C:\OpenSesameC\lib\site-packages\libopensesame\loop.py", line 337, in run
    self.experiment.items.execute(self._item)
  File "C:\OpenSesameC\lib\site-packages\libopensesame\item_store.py", line 91, in execute
    self.run(name)
  File "C:\OpenSesameC\lib\site-packages\libopensesame\item_store.py", line 106, in run
    self[name].run()
  File "C:\OpenSesameC\lib\site-packages\libopensesame\sequence.py", line 51, in run
    self.experiment.items.run(_item)
  File "C:\OpenSesameC\lib\site-packages\libopensesame\item_store.py", line 106, in run
    self[name].run()
  File "C:\OpenSesameC\lib\site-packages\libopensesame\loop.py", line 337, in run
    self.experiment.items.execute(self._item)
  File "C:\OpenSesameC\lib\site-packages\libopensesame\item_store.py", line 91, in execute
    self.run(name)
  File "C:\OpenSesameC\lib\site-packages\libopensesame\item_store.py", line 106, in run
    self[name].run()
  File "C:\OpenSesameC\lib\site-packages\libopensesame\sequence.py", line 51, in run
    self.experiment.items.run(_item)
  File "C:\OpenSesameC\lib\site-packages\libopensesame\item_store.py", line 106, in run
    self[name].run()
  File "C:\OpenSesameC\lib\site-packages\libopensesame\loop.py", line 337, in run
    self.experiment.items.execute(self._item)
  File "C:\OpenSesameC\lib\site-packages\libopensesame\item_store.py", line 91, in execute
    self.run(name)
  File "C:\OpenSesameC\lib\site-packages\libopensesame\item_store.py", line 106, in run
    self[name].run()
  File "C:\OpenSesameC\lib\site-packages\libopensesame\sequence.py", line 51, in run
    self.experiment.items.run(_item)
  File "C:\OpenSesameC\lib\site-packages\libopensesame\item_store.py", line 106, in run
    self[name].run()
  File "C:\OpenSesameC\lib\site-packages\libopensesame\loop.py", line 337, in run
    self.experiment.items.execute(self._item)
  File "C:\OpenSesameC\lib\site-packages\libopensesame\item_store.py", line 91, in execute
    self.run(name)
  File "C:\OpenSesameC\lib\site-packages\libopensesame\item_store.py", line 106, in run
    self[name].run()
  File "C:\OpenSesameC\lib\site-packages\libopensesame\sequence.py", line 51, in run
    self.experiment.items.run(_item)
  File "C:\OpenSesameC\lib\site-packages\libopensesame\item_store.py", line 106, in run
    self[name].run()
  File "C:\OpenSesameC\lib\site-packages\libopensesame\sketchpad.py", line 124, in run
    self._t0 = self.set_item_onset(self.canvas.show())
  File "C:\OpenSesameC\lib\site-packages\openexp\_canvas\psycho.py", line 144, in show
    stim.draw()
  File "C:\OpenSesameC\lib\site-packages\psychopy\visual\text.py", line 739, in draw
    self._pygletTextObj.draw()
  File "_build/bdist.macosx-10.5-x86_64/egg/pyglet/font/__init__.py", line 565, in draw
    self._layout.draw()
  File "_build/bdist.macosx-10.5-x86_64/egg/pyglet/text/layout.py", line 852, in draw
    self.batch.draw()
  File "_build/bdist.macosx-10.5-x86_64/egg/pyglet/graphics/__init__.py", line 554, in draw
    func()
  File "_build/bdist.macosx-10.5-x86_64/egg/pyglet/graphics/__init__.py", line 486, in 
    (lambda d, m: lambda: d.draw(m))(domain, mode))
  File "_build/bdist.macosx-10.5-x86_64/egg/pyglet/graphics/vertexdomain.py", line 313, in draw
    glDrawArrays(mode, starts[0], sizes[0])
WindowsError: exception: access violation reading 0x00000010

Troubleshooting
I tried the things suggested in this post: http://forum.cogsci.nl/index.php?p=/discussion/2676/windows-error-access-violation-crash. Including explicitly deleting canvas items in the sketchpad.py script, and upgrading psychopy. Pyglet was already the latest version.
The Legacy backend seems to be more sluggish and I also get the previous crash (pythonw not responding + blue spinning wheel galore). Also, it doesn't handle switching between the experiment screen and the calibration screen well plus I prefer a dual screen set-up, so I prefer avoiding this.

Is there anything else I could try? Maybe others ran into similar issues and managed to resolve this?

Apologies for the lengthy post.
tl;dr: I have a mixture of Windows processing and Psychopy issues, help please.

IMG_2089.JPG 72.8K

Comments

  • sebastiaansebastiaan Posts: 2,670

    Hi,

    I suspect that these are all manifestations of a bug (a memory leak) in PyGlet or PyOpenGl, which are used by PsychoPy. This happens sometimes, and when it does, there's little that you can do about it.

    But I was just reading on the PsychoPy forum that PsychoPy standalone is now bundled with a version of PyGlet in which this bug is fixed. If that's true, that might be something for OpenSesame as well. @JonPeirce Is that correct?

    Cheers,
    Sebastiaan

    Thanked by 1cesco

    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

  • sebastiaansebastiaan Posts: 2,670
    edited July 21

    @cesco I updated PyGlet to 1.3.0b1 in the latest prerelease of OpenSesame 3.1.8 (a1-py2.7-win32-2). Could you try whether this resolves the issue?

    Thanked by 1cesco

    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

  • cescocesco Posts: 14

    Thank you Sebastiaan, both posts were really helpful. In the end, I made the experiment work by splitting the whole session into two separate halves, which works fine but it's far from perfect / clean. Either way, I'll give PyGlet 1.3.0b1 a go and will report back here!

  • cescocesco Posts: 14

    @Sebastiaan, negative.

    Things do run much smoother now and the problems with the screen going idle and image looking scrambled appear to have disappeared now. By monitoring the system's performance it is easy to see that gb.collect() helps a lot too.

    I tested the experiment with the prerelease you linked twice today. The first time was perfect. The second time I got the same WindowsError with about 10% of trials remaining.

    Oddly enough in my case, it appears to be related to text rendering in Pyglet. Since I only have two target letters, do you think it would make sense to replace these by images of the letters?

Sign In or Register to comment.