Giter Site home page Giter Site logo

Comments (9)

Athanasius avatar Athanasius commented on May 27, 2024 1

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.

albertosottile avatar albertosottile commented on May 27, 2024

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.

albertosottile avatar albertosottile commented on May 27, 2024

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.

Athanasius avatar Athanasius commented on May 27, 2024

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.

Athanasius avatar Athanasius commented on May 27, 2024

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.

Athanasius avatar Athanasius commented on May 27, 2024

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.

Athanasius avatar Athanasius commented on May 27, 2024

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.

albertosottile avatar albertosottile commented on May 27, 2024

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.

Athanasius avatar Athanasius commented on May 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.