[Pythonmac-SIG] Difference between pythonw and python?

Jack Jansen Jack.Jansen at cwi.nl
Thu Apr 1 15:32:38 EST 2004


On 1 Apr 2004, at 17:05, Bob Ippolito wrote:

> On Mar 31, 2004, at 2:46 AM, Jens Miltner wrote:
>
>> What exactly (at the code level) is the difference between pythonw 
>> and python?
>> The reason I'm asking is that I'm trying to get Tkinter work with an 
>> application that links against Python.framework and uses python as 
>> it's scripting language (MacCvsX).
>> I do have problems with Tk not being recognized as a valid symbol 
>> name in the python scripts (despite the fact that those scripts do 
>> have a "from Tkinter import *" statement and they do work when 
>> executed from a shell), so I thought this might be related to the 
>> pythonw vs. python problem...
>>
>> Anybody knows what the exact difference between the two is?
>
> You have multiple versions of Python installed.  It's highly likely 
> that your application and any extensions you have built are linking 
> against /Library/Frameworks/Python.framework (or a homedir version) 
> but you are running a python interpreter linked to 
> /System/Library/Frameworks/Python.framework (if you are using OS X 
> 10.3).  If that is not the exact case, then it's something very much 
> like that case.

Bob is right, probably. You are apparently using Alexandre Parenteau's 
MacCVS stuff in your application (I might be giving Alexandre too much 
credits here, I haven't a clue how many people are involved with 
MacCVS/WinCVS/cvsGUI, but he was always the main contact point back 
when I used it a lot). My guess is that this is linked against an older 
Python framework, probably MacPython 2.2. The warning message about 
_cvsgui is in a funny place, though, but I assume this is because the 
warning goes to stderr and the other messages to stdout or something.

Then something happens that I don't fully understand, but it is 
probably caused by the problem above: _tkinter.so fails to load (or 
cannot be found), this is the last line.

 From here on everything is understandable again: if you do another 
"import Tkinter" you will get the incomplete Tkinter module that failed 
to import _tkinter, and hence it misses all the interesting bits.

I think you will be able to reproduce this problem with command-line 
Python by doing "import cvsgui" before you import Tkinter. You may have 
to add /Developer/Applications/3rd Party/MacCvs/PythonLib to sys.path 
before importing cvsgui.

If you manage to reproduce the problem with the commandline: try again, 
but now run with "pythonw -vv". This will make python *very* verbose on 
imports, also telling you about the failed attempts. Hopefully this 
will tell you more, or otherwise send the transcript here again and 
we'll have a look.
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma 
Goldman




More information about the Pythonmac-SIG mailing list