Error: invalid literal for int() with base 10:

157 views
Skip to first unread message

Jamie Hershaw

unread,
Sep 6, 2013, 12:29:45 AM9/6/13
to psychop...@googlegroups.com
Hi,

I'm fairly new to psychopy. I'm using version 1.78 Builder on Windows. I'm trying to draw a polygon, but the actual shape changes with each condition that is specified in my excel file for the loop. The column, 'Shape,' has the numbers 3 or 4 in it (triangle or rectangle). When I run the experiment, it can't generate it and gives me this error:

Error when generating experiment script:
invalid literal for int() with base 10: $Shape

My hunch was that it's not recognizing the values in the Shape column as integers. I checked the character type in my excel file and set them all to numbers with no decimal points, but that did not solve the problem. I do not know what else could be causing this. Any help is appreciated.

Thanks,
Jamie

Michael MacAskill

unread,
Sep 6, 2013, 12:41:29 AM9/6/13
to psychop...@googlegroups.com
Hi Jamie,

I suspect what is happening is that you need to select "set every repeat" rather than "constant" in the popup button next to the "N vertices" field. This is what tells PsychoPy to get a fresh number from the Shape variable on each iteration of the loop.

Because (I'm guessing) it is set to "constant", the polygon is instead being created at the very beginning of the script before the Shape variable has even been defined, so it is trying to use the literal text "$Shape" for the number of vertices rather than an actual number.

PsychoPy will get better shortly at pointing out these problems (assuming this is the cause for you).

Regards,

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

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



Jamie Hershaw

unread,
Sep 6, 2013, 12:46:52 AM9/6/13
to psychop...@googlegroups.com
Thanks for the fast response Michael. Unfortunately, that did not solve the problem. I checked to see what error having it set to "constant" would throw, and it produces a different error ("bad file descriptor").

Jamie

Jeremy Gray

unread,
Sep 6, 2013, 12:49:46 AM9/6/13
to psychop...@googlegroups.com
another possibility is that the $ is not actually needed in the spot you are using it. have you tried just Shape?


--
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/b5cc5a18-61fc-4034-80d8-375d12d52cd0%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Michael MacAskill

unread,
Sep 6, 2013, 12:52:03 AM9/6/13
to psychop...@googlegroups.com

On 6 Sep, 2013, at 16:46, Jamie Hershaw <jnhe...@gmail.com> wrote:

> Thanks for the fast response Michael. Unfortunately, that did not solve the problem. I checked to see what error having it set to "constant" would throw, and it produces a different error ("bad file descriptor").

The error has changed, so that is definitely a good thing :-)

-- Please post the full text of the error message(s) and which setting they correspond to (constant vs set every repeat): it seems to me they should be the other way around.

-- Have you actually managed to get the xlsx/csv file connection working to specify other variables?

Cheers,

Mike

Michael MacAskill

unread,
Sep 6, 2013, 12:53:47 AM9/6/13
to psychop...@googlegroups.com
Or perhaps just send your .psyexp and .xlsx file to me directly if you want (will be here for next 20 min or so…)

Cheers
Reply all
Reply to author
Forward
0 new messages