Bug(s) in Python 3.1.1 Windows installation

Alf P. Steinbach alfps at start.no
Thu Oct 29 06:46:36 CET 2009


* John Machin:
> On Oct 29, 11:06 am, "Alf P. Steinbach" <al... at start.no> wrote:
>> (3) Tkinter not bundled, misleading & incomplete documentation.
>>
>> With the file associations in place (the installer managed to do that) running
>> console programs works fine.
>>
>> However, running Tkinter based programs does *not* work:
>>
>> <code filename="ellipse.pyw">
>> import Tkinter
> 
> What documentation are you reading? As you are running Python 3.1, you
> might like to consider reading 3.1 documentation. Many things have
> been changed from 2.X, including renaming unconventionally named
> modules and packages. In particular see http://docs.python.org/3.1/library/tkinter.html
> ... in general, see the whatsnew docs that I pointed you at.

Thanks. I wasn't expecting that the names used to access some library had 
changed just because the core language had been changed, and I didn't notice 
this little change of letter case  --  but Ethan Furman set me straight on that 
earlier, as I reported else-thread. I'm new to the language.


> If you are trying to run 2.X code under 3.1, don't expect it to work
> straight away. Find "2to3" in the docs.

Thanks again!

I don't see how "2to3" can fix up "/" operators without having static type 
information. In the case of integer args "/" should be replaced with "//" (as I 
understand it), while for floats it should be left alone as-is. Hm.

It seems to me that Pyrex has demonstrated that declarations *can* be combined 
sort of naturally with the rest of the language. What I miss most is the kind of 
  force-use-of-declarations directive like Perl "use strict" or VBScript "option 
explicit". Of course that would require some way to declare variables, at least 
their names... But perhaps this is already in 3.x? I'll probably find out.



> [snip]
>> Checking I find that while there is a Tkinter folder there is no file
>> [Tkinter.py] in this installation, i.e. the Tkinter module is not bundled with
>> this distribution.
> 
> but the tkinter module is bundled
> 
>> That's bad news for any novice wanting to start learning the language: a main
>> "battery" is missing! The documentation gives the impression that Tkinter can
> 
> Which documentation?

I see that the docs installed with 3.1.1 uses all lowercase in the code.

But the tutorials etc. on the net, referenced from the 3.1.1 documentation, have 
not been updated to mention that they're not version-inpendent any longer.

E.g. <url: http://infohost.nmt.edu/tcc/help/pubs/tkinter/> (which says it is a 
reference), and others referenced from the 3.1.1 documentation (I think the 
3.1.1 documentation should clearly state that the referenced get-the-details 
external documentation is for an earlier version of Python).


>> just be used, and it could just be used with ActivePython. Here the novice has
> 
> ActivePython 2.X or 3.X?

2.6, I couldn't find any later ActivePython version.

Of course it works just fine in 3.x when one writes lowercase "tkinter".



>> to figure out not only that it isn't there, but also how to get it!
>>
>> Checking <url:http://pypi.python.org/pypi/>, the package index, nope, no
>> Tkinter there.
> 
> PyPI is for third-party modules and packages.

Does that mean that Tkinter is *not* third-party, but now part of the language 
like part of its standard library?


>> Typing "tkinter" in the Firefox address bar leads to <url:http://wiki.python.org/moin/TkInter>, and it has a recipe for checking for
>> Tkinter support/installation:
>>
>> <checking results>
>> Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)] on
>> win32
>> Type "help", "copyright", "credits" or "license" for more information.
>>  >>> import _tkinter
>>  >>> import Tkinter
>> Traceback (most recent call last):
>>    File "<stdin>", line 1, in <module>
>> ImportError: No module named Tkinter
>>  >>>
>> </checking results>
>>
>> The recipe now calls for adding path to directory with [Tkinter.py], but as
>> mentioned no such file in this installation...
>>
>> Cheers,
>>
>> - Alf
>>
>> PS: This was not unexpected. It was exactly why I earlier didn't even look at
>> CPython (umpteen bad experiences with *nix ports) but used ActivePython. I'm
>> hopeful that I will find where Tkinter resides on the net, but hey, it should at
>> least be documented, up front I mean (it's possibly mentioned somewhere, yes?).
> 
> Yes. You'll find that tkinter resides also on your hard disk (unless
> you chose not to install it).
> 
> Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
> (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import tkinter
>>>> tkinter.__file__
> 'C:\\python31\\lib\\tkinter\\__init__.py'

Hey, that's very useful! :-)


> Didn't you do a search of your hard disk for "Tkinter"?

Yes, it only found a folder and some DLLs, I think it was.

But given the filename you showed above I now found out about "packages" in Python.

I guess it's the stumble-upon principle at work. <g>


Cheers,

- Alf



More information about the Python-list mailing list