TypeError: coercing to Unicode: need string or buffer, int found

624 views
Skip to first unread message

semeon...@gmail.com

unread,
Dec 12, 2015, 11:58:12 AM12/12/15
to psychopy-users
Hello all - 

I'm having a bit of trouble passing an experiment through WinPython. I've include the code preceding the error, as well as the error message that pops up. The experiment works on the standalone version of psychopy as well as running it through an installed version of python 2.7.10 on my pc. Unfortunately the experiment needs to be run through WinPython.

# set up handler to look after randomisation of conditions etc
Introduction_Loop = data.TrialHandler(nReps=1, method='sequential', 
    extraInfo=expInfo, originPath=-1,
    trialList=data.importConditions('procedure\\Introduction.csv'),
    seed=None, name='Introduction_Loop')


Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
==== No Subprocess ====
>>> 
saved data to u'C:\\Users\\Owner\\Desktop\\SART\\send\\data/001_001_SART_4.csv'
Traceback (most recent call last):
  File "C:\Users\Owner\Desktop\SART\send\SART_6.py", line 117, in <module>
    seed=None, name='Introduction_Loop')
  File "C:\Users\Owner\Desktop\SART\send\WinPython\WinPython-32bit-2.7.10.3\python-2.7.10\lib\site-packages\psychopy\data.py", line 773, in __init__
    self.originPath, self.origin = self.getOriginPathAndFile(originPath)
  File "C:\Users\Owner\Desktop\SART\send\WinPython\WinPython-32bit-2.7.10.3\python-2.7.10\lib\site-packages\psychopy\data.py", line 633, in getOriginPathAndFile
    if originPath is None or not os.path.isfile(originPath):
  File "C:\Users\Owner\Desktop\SART\send\WinPython\WinPython-32bit-2.7.10.3\python-2.7.10\lib\genericpath.py", line 37, in isfile
    st = os.stat(path)
TypeError: coercing to Unicode: need string or buffer, int found

Michael MacAskill

unread,
Dec 13, 2015, 1:46:46 AM12/13/15
to psychop...@googlegroups.com
Hello Semeon?,

The error message points specifically to you using a value of -1 for the originPath parameter, when this needs to be a string of characters (representing a file path on your computer). It is optional for most purposes anyway, so you can likely just omit that parameter.

This error wouldn't be specific to a given platform or installation of PsychoPy…

Regards,

Michael
> --
> You received this message because you are subscribed to the Google Groups "psychopy-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
> To post to this group, send email to psychop...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/f51828a8-8895-4891-80bf-04441af979a1%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
Michael R. MacAskill, PhD 66 Stewart St
Research Director, Christchurch 8011
New Zealand Brain Research Institute NEW ZEALAND

Senior Research Fellow, michael....@nzbri.org
Te Whare Wānanga o Otāgo, Otautahi Ph: +64 3 3786 072
University of Otago, Christchurch http://www.nzbri.org/macaskill

Reply all
Reply to author
Forward
0 new messages