psychopy.org | Reference | Downloads | Github

Error in opening .exe file built using cx_freeze with a psychopy based animation

When I try to open the .exe file this error appears. Not sure where to begin in fixing this. Or is there another way to create .exe files for psychopy animations?

cx_Freeze: Python error in main script

File “C:\Users\Admin\Anaconda3\envs\python2\lib\site-packages\psychopy\preferences\preferences.py”, line 140, in loadAll
self.general = self.userPrefsCfg[‘general’]
File “C:\Users\Admin\Anaconda3\envs\python2\lib\site-packages\configobj.py”, line 554, in getitem
val = dict.getitem(self, key)
KeyError: ‘general’

The problem with cx_freeze and py2exe and similar is that PsychoPy has a large and complex set of dependencies and these tools never get them all correct so you have to write something telling it about them all.
From the cx_freeze docs, my guess is that you need to specify configobj in the includes parameter for your setup script.

But, wait, you’re trying to save an “animation”? How about saving your screen frames out as a movie instead?

I changed my setup script to this but I still get the same error.

import sys
from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os","numpy"], "excludes": ["tkinter","collections.abc"], "includes": ["configobj"]}  

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(  name = "guifoo",
         version = "0.1",
        description = "Python program on a visual illusion.",
        options = {"build_exe": build_exe_options},
        executables = [Executable("psychopy_method.py", base=base)])

I decided not to export the frames as a movie since I need to be able to manipulate the animation in real time. I need to change the color, speed, etc. Thanks!