-
-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"FileNotFoundError" using pathlib after freezing the script #1878
Comments
Python from python.org or conda? What version? |
Python from python.org Python 3.11.3 (tags/v3.11.3:f3909b8, Apr 4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)] |
I cannot reproduce with python 3.11.4
The code in comments using pyfakefs is to be used in a test, if reproducible in a fakefs. NOTE: folder = "//server/share" can be changed to folder = "\\server\share" and the result is the same. |
Release 6.15.3 is out! Can you give me feedback? |
Hi, I have upgraded to the latest version and unfortunately the issue persists... |
Can you reproduce the error with my test code in the previous comment? |
When running main.exe, it returns []. When running main.exe with all lines uncommented, it returns this error: FileNotFoundError: [Errno 2] No such file or directory in the fake filesystem: '/local/path' Unfortunately, the behaviour is the same when running both the .exe and the .py versions. |
As a part of a python application, files in unmapped network drive are accessed. The script runs like a charm when running the .py file, but after freezing it as an .exe file using cx_freeze I am getting the following error:
FileNotFoundError: [WinError 3] The system cannot find the path specified: '\one\random\folder\file.txt'
When running the following line:
sizelist = [float(Path(x).stat().st_size) for x in ListOfFiles]
The file definitely exists. I have noticed that under file properties in Windows, the file path is shown as:
\?\UNC\one\random\folder\file.txt
I have isolated the issue as caused by cx_Freeze. I have frozen the following script in cx_Freeze and pyinstaller:
When frozen with pyinstaller, Path(p).is_file() is True for all files. With cx_Freeze, some obtain True and the ones with the "\?\UNC" start of the path fail.
Is it there a way to solve this issue on cx_Freeze?
The text was updated successfully, but these errors were encountered: