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

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to