I have a python script that I'd like to freeze. I made the cx_freeze
script, and ran it. The .exe
works well, but in the frozen script I open a .html
file. When the file opens the webbrowser gives me the error " File not found: Firefox cannot find the file at /c:/blah/blah/blah/somefile.html
"
As I understand it, this is because cx_freeze
is confusing my OS between linux and Windows. However, I'm not sure this is it because I have the code
if sys.platform == "win32":
base = "Win32GUI"
In my setup file. Does anyone know what's going on?
My entire setup file is
import sys
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}
# 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 = "someexe",
version = "0.1",
description = "someexe description",
options = {"build_exe": build_exe_options},
executables = [Executable("someexe.py", base=base)])
copied from the cx_freeze distutils page and edited to fit my needs.
Instead of using os.chdir('C:/path/to/dir')
, you should be using os.chdir('C:\\path\\to\\dir')
. It's an error in your script, not your cx_freeze setup file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.