Comments (9)
My apologies, it turns out the project in question was specifically unsetting TCL_LIBRARY due to issues in python2.7! So yes, the fix in 0.9.3.2 does fix the 'import tkinter' issue.
from py2exe.
Thanks for reporting this. It looks clear to me now that the tkinter hook will never work with newer Python versions. I will look for an alternative way to retrieve the tk and tcl paths as soon as I have some spare time.
from py2exe.
Hi, this bug should be fixed now. Can you please install the wheels from this address:
https://bintray.com/alby128/py2exe/py2exe/0.9.3.2/view/files?sort=name&order=asc#files/
and tell me if this works for you now? Thanks again for reporting this.
from py2exe.
I can confirm this at least fixes the issue for a simple test case. It took me a while to think to check closed tickets on this. Will this version be released now ?
import tkinter as tk
print('hello world')```
from py2exe.
However, a more complex python program then fails with:
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
C:/Users/Athan/Documents/Devel/EDMarketConnector/lib/tcl8.6 C:/Users/Athan/Documents/Devel/EDMarketConnector/lib/tcl8.6 C:/Users/Athan/Documents/Devel/lib/tcl8.6 C:/Users/Athan/Documents/Devel/EDMarketConnector/library C:/Users/Athan/Documents/Devel/library C:/Users/Athan/Documents/Devel/tcl8.6.9/library C:/Users/Athan/Documents/tcl8.6.9/library
This probably means that Tcl wasn't installed properly.```
From experience with pyinstaller this could perhaps be fixed by copying all of the relevant TCL files into the application's directory and specifying them in setup.py, but presumably this is something that should be fixed within py2exe itself.
from py2exe.
Ah, no, I see that the build process copies into lib/tcl, but the above is looking for lib/tcl8.6. Should the copy not be stripping the version off ?
Edit: Ah, no, as the tcl8.6 is within lib/tcl in the python distribution. So either it all needs copying, or else some tweak if this is meant to be found in the _tkinter.lib ?
from py2exe.
And only now do I spot the documentation on that bit of hooks.py. So it's necessary to add the def tk_env_paths()
to any application using tkinter, in order for the py2exe produced .exe to work ?
from py2exe.
Hi, thanks for reporting this. Before reopening this issue, I would like to have a reproducible example of the error. Could you please post here your script file and the setup.py
file that caused this error? In this case, it could also be helpful to have a list of all the content of the project folder.
The tk_env_paths
function should never be manually called because it is already executed in the bootloader of the packed executable. As a matter of fact, it would be nice if you could add a print of os.environ["TCL_LIBRARY"]
and os.environ["TK_LIBRARY"]
in the beginning of your script, pack it, then run again the packed executable to see if the hook worked as intended.
from py2exe.
I'll need to expand on the very simply test case above to find the minimum that triggers the issue. Once I have that I'll see what the environ values are coming out as. Tomorrow. Thanks for the speedy response.
from py2exe.
Related Issues (20)
- 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?
- How do I get an app using jaydebapi to work as an executable ?
- Failure to import zipextimporter with error "No module named '_memimporter'"
- [freeze][zipfile] Dependent packages and modules are not zipped to library.zip or packed to .exe bin
- ImportError: MemoryLoadLibrary failed loading PyQt5\QtWidgets.pyd: The specified module could not be found. (126)
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.