Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Building importable _tkinter on Windows

Reply
Thread Tools

Building importable _tkinter on Windows

 
 
Terry Reedy
Guest
Posts: n/a
 
      03-10-2013
If you have tried to build _tkinter on Windows from the cpython
repository, and have 'import tkinter' work, please share your
experience, successful or not. I and another person have both failed.

Following the directions in the devguide (and for one step,
PCBuild/readme), I did essentially the following.

* download and install TortoiseHG and an svn client (for external.bat)
* download and install c++ 2010 express
* in directory X, clone the python.org hg repository as cpython
* in X/cpython, run Tools/buildbot/external.bat to fetch and compile
tcl/tk and other external dependencies.
* run visual studio with X/cpython/PCBuild/pcbuild.sln (I just double
click on the .sln file. Choose c++ 2010 if other compilers are listed.

* build debug version of 3.4 (F7), stored as .../PCBuild/python_d.exe.
This also builds in the same directory things like _bz2_d.pyd and
_lzma_d.pyd (whose dependencies are also fetched by external.bat) and
_tkinter_d.pyd, apparently without error. The last is 43 kb. That is
smaller than the others, but reasonable considering that it just
forwards calls to tk. My installed 3.3 _tkinter.pyd is 41 kb.

* run python_d.exe. sys.path is
['',
'F:\\Python\\dev\\cpython\\PCbuild\\python34_d.zip ',
'F:\\Python\\dev\\cpython\\DLLs',
'F:\\Python\\dev\\cpython\\lib',
'F:\\Python\\dev\\cpython\\PCbuild', # where _tkinter, etc are
'F:\\Python\\dev\\cpython',
'F:\\Python\\dev\\cpython\\lib\\site-packages']

>>> import bz2, lzma # these import _bz2 and _lzma
>>> import tkinter

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "F:\Python\dev\cpython\lib\tkinter\__init__.py ", line 36, in
<module>
from tkinter import _fix
File "F:\Python\dev\cpython\lib\tkinter\_fix.py", line 65, in <module>
import _tkinter
ImportError: DLL load failed: The specified module could not be found.
[83479 refs, 32096 blocks]

My two hypotheses:

1. There is something wrong with _tkinter_d.pyd in particular such that
it is not recognized as a dll file. To test this, I renamed my installed
_tkinter, copied and renamed _tkinter_d, ran installed python 3.3, and
got a similar error
ImportError: DLL load failed: %1 is not a valid Win32 application.
Perhaps this verifies the hypothesis, perhaps it is due to a mismatch
between normal builds and debug builds.

2. CPython somehow special-cases the _tkinter import so that it fails in
the fresh build environment. This seems dubious, but who knows?

Since the Windows buildbots build and test cpython more or less the same
way, test/test_tkinter should pick up the same problem -- *if* it is
actually run, but because of some problems with the test suite, I am not
sure it is, rather than being skipped. Or maybe there is some
significant small different in the buildbot process.

Does anyone have any idea what else I might do?

I expect to eventually post on pydev or the tracker, but I wanted to
first try to collect more information here (which I wish more people
would do).

--
Terry Jan Reedy

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Building importable _tkinter on Windows (solved) Terry Reedy Python 0 03-10-2013 11:04 PM
how to check if a module is importable? Robert P. J. Day Python 2 01-20-2010 02:51 PM
easy_install of module produces un-importable result Val Python 2 12-08-2008 09:47 PM
building _tkinter module with .NET 2005? joshusdog@gmail.com Python 1 04-27-2007 11:00 PM
Why can I extend, but not include, DL::Importable? Daniel Berger Ruby 3 10-30-2004 03:34 AM



Advertisments