>>> s = 'C:\U' Traceback (most recent call last): File "<interactive input>", line 1 SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escapeNever use single
\
that way in path for Windows,because of escape character.
Okay:
>>> s = 'C:/U' >>> s 'C:/U' >>> s = r'C:\U' >>> s 'C:\\U' >>> s = 'C:\\U' >>> s 'C:\\U'Example setup script Cx_Freeze.
#cx_run.py from cx_Freeze import setup,Executable import sys # Replaces commandline arg 'build' #sys.argv.append("build") # If need to include/exclude module/packages includes = [] excludes = [] packages = [] # Console or Win32GUI base = None if sys.platform == "win32": #base = 'Console' base = 'Win32GUI' # Name of file to make ".exe" of filename = "Test1.py" setup( name = 'Myapp', version = '0.1', description = 'Cx test', options = {'build_exe': {'excludes':excludes,'packages':packages,'includes':includes}}, executables = [Executable(filename, base=base, icon=None)]) #--| From command line #python cx_run.py buildThere can bye problem with cx_Freeze and Pygame.
Use Pyinstaller,
pip install pyinstaller
Test with your code(Python 3.6.2),i use pipenv for virtual environment in this test.
From command line:
pyinstaller --noconsole --onefile Test1.pyIn dist folder there will be 1 file
Test1.exe
.Edit:
I did a test with cx_Freeze and it did work with your pygame code