# Reading an old Psychopy script written with Python 2

**URL:** <https://discourse.psychopy.org/t/reading-an-old-psychopy-script-written-with-python-2/27705>\
**Category:** Coding\
**Tags:** python3, python2\
**Created:** [February 28, 2022, 2:09pm UTC](https://discourse.psychopy.org/t/reading-an-old-psychopy-script-written-with-python-2/27705 "2022-02-28T14:09:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![EELLLLL](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/eelllll/32/33132_2.png) [@EELLLLL](https://discourse.psychopy.org/u/EELLLLL)\
**Post date:** [February 28, 2022, 2:09pm UTC](https://discourse.psychopy.org/t/reading-an-old-psychopy-script-written-with-python-2/27705/1 "2022-02-28T14:09:01Z")

</div>

Hello,  
I am looking for a solution to read this script in Python 2 using an older version of Psychopy !

I have been handed a script that was written about 3 years ago, using Python 2, the version of Psychopy is probably something like 3.2.0 and I really have to make it work for the interns in my lab.

When creating a virtual environment with Python 2 (venv, anaconda or another computer), and trying to install psychopy on it there are errors like (“python setup.py egg\_info” failed with error code 1). Also, I haven’t found a way to change the Python version inside Psychopy (just found a way to change the psychopy version).

Note : I have already tried to make it readable by Python3 by using 2to3 library, correcting many, many things in the script, I spent multiple days on debugging and trying every solution, but the output is still not as it should be and I don’t know how to get any further.

Thank you in advance !

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [February 28, 2022, 3:47pm UTC](https://discourse.psychopy.org/t/reading-an-old-psychopy-script-written-with-python-2/27705/2 "2022-02-28T15:47:50Z")

</div>

Was the original written in Coder or Builder? You could upload the file here in case someone else can convert it for you.

---

<div class="post-metadata">

**Author:** ![EELLLLL](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/eelllll/32/33132_2.png) [@EELLLLL](https://discourse.psychopy.org/u/EELLLLL)\
**Post date:** [March 1, 2022, 2:54pm UTC](https://discourse.psychopy.org/t/reading-an-old-psychopy-script-written-with-python-2/27705/3 "2022-03-01T14:54:20Z")

</div>

Hello,  
It was written by someone else a long time ago in the coder part. If it was done in the builder, changing the version would have been enough.  
Here is the code with the files :  
[psychopy\_files\_swahili.zip](https://discourse.psychopy.org/uploads/short-url/pkdkaTj0U7cnNSry0yd6DZ4uRvS.zip) (8.8 KB)

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [March 1, 2022, 4:22pm UTC](https://discourse.psychopy.org/t/reading-an-old-psychopy-script-written-with-python-2/27705/4 "2022-03-01T16:22:36Z")

</div>

Although it failed to run in my copy of PsychoPy 1.90.3, it seemed to work in 2020.2.10 and 2021.1.4. Just in case it makes a difference, here is an updated .py file (saved from 2021.1.4)

[ManipFrancaisSwahiliV3.py](https://discourse.psychopy.org/uploads/short-url/xizS3fnlYMiMfe4sy6XVztI4k5j.py) (22.2 KB)

---

<div class="post-metadata">

**Author:** ![EELLLLL](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/eelllll/32/33132_2.png) [@EELLLLL](https://discourse.psychopy.org/u/EELLLLL)\
**Post date:** [March 1, 2022, 4:49pm UTC](https://discourse.psychopy.org/t/reading-an-old-psychopy-script-written-with-python-2/27705/5 "2022-03-01T16:49:54Z")

</div>

The problem was never the fact that it doesn’t work. But the output isn’t complete. It only gives a few responses instead of the full one.

---

<div class="post-metadata">

**Author:** ![EELLLLL](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/eelllll/32/33132_2.png) [@EELLLLL](https://discourse.psychopy.org/u/EELLLLL)\
**Post date:** [March 2, 2022, 9:38am UTC](https://discourse.psychopy.org/t/reading-an-old-psychopy-script-written-with-python-2/27705/6 "2022-03-02T09:38:18Z")

</div>

How about this file ? It’s the original one written in python 2 (not modified). Thank you in advance for your help !  
[ManipFrancaisSwahiliV1.zip](https://discourse.psychopy.org/uploads/short-url/rbgc2rAZCsFoV4Q0iA4qlVJSjok.zip) (8.1 KB)
