psychopy.org | Reference | Downloads | Github

Error running psychopy executable compiled with py2exe

Hello,

I used psychopy 1.8 to develop a cognitive task and now I want to make it a standalone executable using py2exe.
I used the following setup code:


from distutils.core import setup
import py2exe
import sys
import os, matplotlib

sys.setrecursionlimit(5000)

#the name of your .exe file
progName = 'association_main.py'

#Initialize Holder Files
preference_files = []
app_files = []
my_data_files=matplotlib.get_py2exe_datafiles()

#define which files you want to copy for data_files
for files in os.listdir('C:\\ProgramData\\Anaconda2\\Lib\\site-packages\\psychopy\\preferences\\'):
    f1 = 'C:\\ProgramData\\Anaconda2\\Lib\\site-packages\\psychopy\\preferences\\' + files
    preference_files.append(f1)

#if you might need to import the app files
for files in os.listdir('C:\\ProgramData\\Anaconda2\\Lib\\site-packages\\psychopy\\app\\'):
    f1 = 'C:\\ProgramData\\Anaconda2\\Lib\\site-packages\\psychopy\\app\\' + files
    app_files.append(f1)


all_files = [("psychopy\\preferences", preference_files),("psychopy\\app", app_files), my_data_files[0]]
file = open('prints.txt', 'w')
file.write(all_files)
file.close()

#define the setup
setup(
                console=[progName],
                data_files = all_files,
                options = {
                    "py2exe":{
                        "skip_archive": True,
                        "optimize": 2
                    }
                }
)

but when I run the resulted executable I get the following error:

Traceback (most recent call last):
File “association_main.py”, line 7, in
File “psychopy_init_.pyo”, line 42, in

File “psychopy\preferences_init_.pyo”, line 8, in

File “psychopy\preferences\preferences.pyo”, line 232, in

File “psychopy\preferences\preferences.pyo”, line 43, in init

File “psychopy\preferences\preferences.pyo”, line 136, in loadAll

File “psychopy\preferences\preferences.pyo”, line 195, in loadAppData

File “configobj.pyo”, line 554, in getitem

KeyError: ‘builder’

I’m using python 2, Windows 7 32bit.

Any clue?