| Reference | Downloads | Github

String.atoi(): deprecated function in Python3


In Psychopy2 P3 1.90.2
The string.atoi() function is deprecated in Python3 yielding errors in the Python3 versions of PsychoPy.
When using the qtgui module, the error “module ‘string’ has no attribute ‘atoi’” is shown.

Replacing the calls in to atoi, atof and atol to int, float and long solve the problem.


Hi Pieter,

Any chance of making those changes and submitting a pull request via GitHub?

I don’t really know what this code does (so wouldn’t be able to easily run some checks), but looking here:

it seems that the second check of elif thisType == int: could be deleted entirely. i.e. it is just necessary to change to int() or float(). The second check for thisType == int presumably wouldn’t ever get executed, and I don’t think long() is a function in Python 3 anymore anyway (int has been extended to cover that).



I agree that lines 197 an 198 could be deleted. long type does not exist anymore in Py3.
Someone already submitted a pull request:


Excellent, looks like this is resolved then.