Using variable to read a row from the conditions file gives - TypeError: object of type 'int' has no len()

Windows 10
Psychopy version: 2020.2.10

When running my experiment locally on my PC I used panda to read and manipulate excel files. Everything works great.
Now I want to run the experiment online and cannot use pandas because you cannot use the import statement.

What I want to do is very simple and I am sure has been done many times.
The experimenter enters the participant number when running the experiment. I then want to use the participant number to read a row of the conditions file.
I assign the participant number entered to an integer variable with the code below.

participant = int(expInfo[ā€˜participantā€™])

In the loop I set the following fields:
nreps$ - 1
selected rows - $participant
condtions - conditions.xlsx

When I run the experiment I get the following error.

TypeError: object of type ā€˜intā€™ has no len()

I have checked the data file and participantNumber has the same value as the participant entered.

I have read every posting that seemed to talk around the subject without finding a solution. I am sure it is something very simple but I cannot work it out. Any help would be greatly appreciated.


I found the problem. nreps$ has to be a string not an integer. When I changes the code to the following it worked.
participant = str(expInfo[ā€˜participantā€™])

1 Like