psychopy.org | Reference | Downloads | Github

Problems running Psychypy in a Stroop Test

Hi everyone:
I write waiting for your help because I’ve used Psichopy for a school project which is composed in a 20-item Stroop test. The problem arises 'cause the program starts working well and test items can be answered, but when the real test starts, only half of the items appear or less, and the program is closed and restarted. I’m not the only one who presents this problem, we have tested the program on four different laptops and we’ve the same problems with the program.
In my particular case, the laptop I use is an ACER ES 14
Windows 10 Home Single Languaje
Operating System 64 bits processos 64 bits
AMD Dual-Core Processor E1-2500 (1,4 GHz)
AMD Radeon HD 8240 with 512 MB Graphics System Memory
2GB DDR3 L Mermory
500GB HDD
Anyway I leave the code that appears when I run the program

Welcome to PsychoPy2!
v1.84.2
Exception in thread Thread-1:
Traceback (most recent call last):
File “C:\Program Files (x86)\PsychoPy2\lib\threading.py”, line 801, in __bootstrap_inner
self.run()
File “C:\Program Files (x86)\PsychoPy2\lib\threading.py”, line 754, in run
self.__target(*self.__args, **self.__kwargs)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\app\connections.py”, line 43, in makeConnections
web.setupProxy()
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\web.py”, line 251, in setupProxy
if tryProxy(proxies) is True:
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\web.py”, line 109, in tryProxy
opener.open(req, timeout=2).read(5) # open and read a few characters
File “C:\Program Files (x86)\PsychoPy2\lib\urllib2.py”, line 431, in open
response = self._open(req, data)
File “C:\Program Files (x86)\PsychoPy2\lib\urllib2.py”, line 449, in _open
’_open’, req)
File “C:\Program Files (x86)\PsychoPy2\lib\urllib2.py”, line 409, in _call_chain
result = func(*args)
File “C:\Program Files (x86)\PsychoPy2\lib\urllib2.py”, line 1227, in http_open
return self.do_open(httplib.HTTPConnection, req)
File “C:\Program Files (x86)\PsychoPy2\lib\urllib2.py”, line 1200, in do_open
r = h.getresponse(buffering=True)
File “C:\Program Files (x86)\PsychoPy2\lib\httplib.py”, line 1136, in getresponse
response.begin()
File “C:\Program Files (x86)\PsychoPy2\lib\httplib.py”, line 453, in begin
version, status, reason = self._read_status()
File “C:\Program Files (x86)\PsychoPy2\lib\httplib.py”, line 409, in _read_status
line = self.fp.readline(_MAXLINE + 1)
File “C:\Program Files (x86)\PsychoPy2\lib\socket.py”, line 480, in readline
data = self._sock.recv(self._rbufsize)
timeout: timed out

()
####### Running: C:\Users\es1-420\Desktop\Sergio\Stroop\Stroop prueba.py #######
the physical diameter of the gabor patch should be 5.24931981156 cm
the physical size of the fixation cross should be 4.19560871661 cm
pyo version 0.8.0 (uses single precision)
43.0787 WARNING User requested fullscreen with size [800 600], but screen is actually [1366, 768]. Using actual size
C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\visual\text.py:271: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
if text == self.text:
Traceback (most recent call last):
File “C:\Users\es1-420\Desktop\Sergio\Stroop\Stroop prueba.py”, line 306, in
run_condition(‘a’)
File “C:\Users\es1-420\Desktop\Sergio\Stroop\Stroop prueba.py”, line 176, in run_condition
stim_text.setText(trial[‘estimuli’])
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\visual\text.py”, line 285, in setText
setAttribute(self, ‘text’, text, log)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\tools\attributetools.py”, line 137, in setAttribute
setattr(self, attrib, value)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\tools\attributetools.py”, line 27, in set
newValue = self.func(obj, value)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\visual\text.py”, line 274, in text
self.dict[‘text’] = unicode(text)
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position 2: ordinal not in range(128)
portaudio error in Pa_AbortStream: Wait timed out

I don’t know if the problem is in the capacities of my laptop or if our test may be wrong programmed, but I’d greatly appreciate your help and kindness.
Thank you very much!

It’s hard to tell without you posting the code you ran, but from the error message, it seems like you are setting the text of your TextStim to something non-ascii, i.e. non-english characters? E.g. if you have the my_text = visual.TextStim(win), then my_text = "red" would work but the danish my_text.text = 'rød' would fail with the UnicodeDecodeError. Usually, this can be solved by explicitly telling python that you’re using a broader character set using a small u as prefix: `my_text.text = u’rød’.

If you generated the script using Builder, this is probably in a code component somewhere. The rest of Builder should be robust to non-ascii characters.

And if you can’t get it to work, try renaming the color to something only from the ascii set. E.g. my_text.text = 'roed', if you can find an appropriate word that still makes sense in your language.

1 Like

A post was split to a new topic: Syntax error in mu experiment

Great help, lindeloev!

In my current experiment (generated in the Builder), I couldn’t present a simple feedback message. It continuously appeared an error after the experiment was unexpectedly interrupted (the error is copied at the end of the answer).

It resulted that this error was because the message was written in Spanish, where we use an initial exclamation mark (i.e., “¡Correcto!” instead of the englih "Correct!).

When I removed the initial exclamation mark, the message worked perfectly.

By the way, the u character worked perfect in the Code Component for feedback:

if not Prac_StimuliResp.keys :
    msg=u'¡No has respondido!'
elif Prac_StimuliResp.corr: #stored on last run routine
    msg=u'¡Correcto!'
else:
    msg=u'¡Incorrecto!'

Error presented:

UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
if text == self.text:
Traceback (most recent call last):
File “D:\Fer - Documentos\PIPELINES y TXT\Python\PsychoPy\Examples testing\ANTI\ANTI_lastrun.py”, line 1403, in
FeedbackMessage.setText(msg)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\visual\text.py”, line 285, in setText
setAttribute(self, ‘text’, text, log)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\tools\attributetools.py”, line 137, in setAttribute
setattr(self, attrib, value)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\tools\attributetools.py”, line 27, in set
newValue = self.func(obj, value)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.84.2-py2.7.egg\psychopy\visual\text.py”, line 274, in text
self.dict[‘text’] = unicode(text)
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc2 in position 0: ordinal not in range(128)