Comments (10)
Hi, thanks for reporting this. Before proceeding with this issue, I would like to reproduce it. If you could provide me the script and the setup.py
file that caused it, that would be great.
from py2exe.
This seems to result from an attempt to explicitly include requests
as a package. I don't see the same issue with, e.g. sqlite3
.
test_tkinter.py:
import tkinter as tk
print('hello world')
fail-setup.py:
# -*- coding: utf-8 -*-
# Created by: python.exe -m py2exe -W setup.py test_tkinter.py
from distutils.core import setup
import py2exe
setup(name="name",
# console based executables
console=[ {'script': 'test_tkinter.py' } ],
# windows subsystem executables (no console)
windows=[],
# py2exe options
zipfile=None,
options={"py2exe":
{
'packages': [ 'requests' ]
}
},
)
DISTUTILS_DEBUG=1 python fail-setup.py py2exe
options (after parsing config files):
options (after parsing command line):
option dict for 'py2exe' command:
{'packages': ('setup script', ['requests'])}
running py2exe
Distribution.get_command_obj(): creating 'py2exe' command object
setting options for 'py2exe' command:
packages = ['requests'] (from setup script)
Distribution.get_command_obj(): creating 'bdist' command object
Distribution.get_command_obj(): creating 'build' command object
setting options for 'build' command:
error: [WinError 3] The system cannot find the path specified: ''
22 missing Modules
------------------
? Cookie imported from requests.compat
? OpenSSL imported from requests.help, urllib3.contrib.pyopenssl
? Queue imported from urllib3.util.queue
? backports imported from urllib3.packages.ssl_match_hostname
? brotli imported from urllib3.response, urllib3.util.request
? collections.Callable imported from requests.compat
? collections.Mapping imported from requests.compat, urllib3._collections
? collections.MutableMapping imported from requests.compat, urllib3._collections
? cookielib imported from requests.compat
? cryptography imported from requests, requests.help, urllib3.contrib.pyopenssl
? readline imported from cmd, code, pdb
? simplejson imported from requests.compat
? socks imported from urllib3.contrib.socks
? urllib.getproxies imported from requests.compat
? urllib.getproxies_environment imported from requests.compat
? urllib.proxy_bypass imported from requests.compat
? urllib.proxy_bypass_environment imported from requests.compat
? urllib.quote imported from requests.compat, urllib3.packages.rfc3986.compat
? urllib.quote_plus imported from requests.compat
? urllib.unquote imported from requests.compat
? urllib.unquote_plus imported from requests.compat
? urllib.urlencode imported from requests.compat, urllib3.packages.rfc3986.compat
Building 'dist\test_tkinter.exe'.
libdir is: dist
Copy c:\users\athan\appdata\local\programs\python\python37-32\python37.dll to dist
Copy C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\DLLs\select.pyd to dist\select.pyd
Copy C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\DLLs\pyexpat.pyd to dist\pyexpat.pyd
Copy C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\DLLs\unicodedata.pyd to dist\unicodedata.pyd
Copy C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\DLLs\_socket.pyd to dist\_socket.pyd
Copy C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\DLLs\_bz2.pyd to dist\_bz2.pyd
Copy C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\DLLs\_lzma.pyd to dist\_lzma.pyd
Copy C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\DLLs\_hashlib.pyd to dist\_hashlib.pyd
Copy C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\DLLs\_ssl.pyd to dist\_ssl.pyd
Copy C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\DLLs\_ctypes.pyd to dist\_ctypes.pyd
Copy C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\DLLs\_tkinter.pyd to dist\_tkinter.pyd
Copy DLL C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\DLLs\tcl86t.dll to dist
Copy DLL C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\DLLs\libssl-1_1.dll to dist
Copy DLL C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\DLLs\tk86t.dll to dist
Copy DLL C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\DLLs\libcrypto-1_1.dll to dist
Traceback (most recent call last):
File "fail-setup.py", line 20, in <module>
'packages': [ 'requests' ]
File "C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\py2exe\distutils_buildexe.py", line 192, in run
self._run()
File "C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\py2exe\distutils_buildexe.py", line 273, in _run
builder.build()
File "C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\py2exe\runtime.py", line 264, in build
self.copy_files(destdir)
File "C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\py2exe\runtime.py", line 539, in copy_files
os.makedirs(os.path.dirname(extdlldir), exist_ok=True)
File "C:\Users\Athan\AppData\Local\Programs\Python\Python37-32\lib\os.py", line 221, in makedirs
mkdir(name, mode)
FileNotFoundError: [WinError 3] The system cannot find the path specified: ''
Comment out the 'packages': [ 'requests' ]
in fail-setup.py and the error goes away. Change it to sqlite3
instead and there's no error.
For the specific project I'm working on only removing requests
isn't enough, so there's more than one module package can cause this. I'll see if I can track down the full set for this project.
from py2exe.
Ah, no, it's a problem with requests. Changing things to:
test_tkinter.py
#!/usr/bin/env python
import tkinter as tk
import requests
print('hello world')
fail-setup.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Created by: python.exe -m py2exe -W setup.py test_tkinter.py
from distutils.core import setup
import py2exe
setup(name="name",
# console based executables
console=[ {'script': 'test_tkinter.py' } ],
# windows subsystem executables (no console)
windows=[],
# py2exe options
zipfile=None,
options={"py2exe":
{
# 'packages': [ 'sqlite3' ]
# 'packages': [ 'requests' ]
}
},
)
also shows the problem. So this is whenever requests
is included, be it from code or explicltly specified in a setup.py.
from py2exe.
Trakcing it down further, is this due to the ceritifi code in hooks.py trying to add in just cacert.pem ?
from py2exe.
And note this doesn't happen if dist_dir has more than one component, i.e.:
options ={"py2exe":
{
'dist_dir': 'dist/test'
}
}
The problem is literally because os.path.dirname() does a os.path.split() on what you pass to it. Pass something without any '/' and you get '' back.
from py2exe.
The problem is that you are using the zipfile=None
option, which was probably supported up to some version in the parent project, but has not been received any maintenance at all in this fork, mostly because I have never used it. I am not sure if this option is compatible with the fixes and additions that I have introduced in py2exe
and, in any case, I have never tested it.
py2exe
contains a lot of features, and I simply do not have the time to follow them all. Worse, I am completely convinced that there are still features that I am totally unaware of.
To make py2exe
more maintainable, a review of the codebase will have to happen later down the road, and some of these features will probably be revised of dropped (bundle_files
is another candidate to be removed because it makes testing a nightmare).
For the moment, I would advise you to avoid using the zipfile=None
option in the setup.py
file. I think that removing that option will make your issues disappear, given that requests
and tkinter
are packages that work with the current version of py2exe
.
If this is not possible or not acceptable for you, I would really appreciate your help in investigating, testing and, possibly, changing the behavior of the zipfile=None
option in this fork of py2exe
. In general, feedback and PRs are always welcome.
I am leaving this issue open so that you can confirm to me that you managed to pack the example code without the zipfile=None
option, then I am going to close it. Later, if you still want support for this option, I encourage you to create a new, more specific issue. Thanks again for your time.
from py2exe.
As it happens I made the decision this evening to remove thet zipfile=None
from the config in our project, to closer match the old python2.7-based setup.py config. I'll double-check tomorrow that the build works without my change to runtime.py.
Given that was in my small test case as well I suspect that build_exe is putting it in by default. Yup, just checked again, build_exe -W again-setup.py test_tkinter.py
put that option in.
from py2exe.
Given that was in my small test case as well I suspect that build_exe is putting it in by default. Yup, just checked again, build_exe -W again-setup.py test_tkinter.py put that option in.
Thanks for reporting this, it now looks clear to me that the zipfile=None
option is introduced by default in the template here: https://github.com/albertosottile/py2exe/blob/88f6745c82ef1064585b6355c43870ad2231a3b6/py2exe/setup_template.py#L176
build_exe
is also a module that should be completely revised. For now, I think that I will probably just remove that line from the template before the next release, and hope that it will not break somebody else workflow.
Please, let me know if everything runs smoothly without the zipfile=None
so that I can close this issue.
from py2exe.
Confirmed working without any changes to py2exe now I lost the zipfile=None
.
I pip uninstalled py2exe, confirmed none was available by trying to run the build, then re-installed 0.9.3.2 and built successfully.
from py2exe.
Thanks for confirming this behavior. I am leaving this issue open as a reminder to adjust the template in build_exe
before the next release.
from py2exe.
Related Issues (20)
- setuptools / pkg_resources now also needs `platformdirs` HOT 7
- setuptools >= 67: pyparsing has been removed from pkg_resources HOT 4
- freeze module of py2exe does not support building a service anymore HOT 6
- Packages with .libs directories result in don't work HOT 6
- Link on the py2exe wiki page does not go anywhere HOT 2
- Missing LICENSE in wheels HOT 4
- AssertionError with Python embeddable package HOT 1
- Py_OptimizeFlag not set correctly during Python initialization
- OSError: [WinError 87] The parameter is incorrect. HOT 2
- PYTHONPATH module location HOT 1
- Exe is created by doesn't run (opens then closes)
- Simple pygame example tries to lookup files inside of `library.zip` HOT 1
- Support Python 3.12 HOT 23
- Impossible to specify different version info for each of the binaries with the new freeze API. HOT 3
- pynput import break the file HOT 1
- PYTHONIOENCODING is ignored
- pendulum package doesn't initialize when unpacking from zipfile
- add version for python 3.12 too
- usage missing
- Does py2exe support 'QtWebEngineWidgets' of PySide6?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from py2exe.