[Pythonmac-SIG] Difference between pythonw and python?

Jens Miltner jum at mac.com
Fri Apr 2 01:58:29 EST 2004


Am 02.04.2004 um 00:43 schrieb Alexandre Parenteau:

> Hi,
>
> Jens is the new maintainer of MacCvsX.
>
> I have the same symptom using 10.3. Which probably means Apple doesn't 
> provide Tkinter with 10.3.
>
> In fact MacCvsX uses Python.framework but doesn't link against it. It 
> is using (last time I checked) the DYLIB loader. I don't know if 
> having Jack's latest 10.3 (which installs on /Library) or Jack's 
> add-on (on top of /System) will work (assuming you install Tkinter as 
> well, which is an additional step I believe). I suspect the former 
> might not, but the later should.

Well, I installed AquaTk and also Jack's add-on on top of the system 
10.3 Python installation (or the other way round - can't remember, but 
it was the "recommended" way to get Tkinter installed), so in theory, 
Tk should work (and, as I mentioned, it works fine from the 
commandline)...

I'll try to reproduce with the commandline, but actually, I doubt that 
importing cvsgui from the commandline will work, since MacCvs actually 
implements some python objects, which I assume are exported inside 
cvsgui... (as I mentioned before, my knowledge of python and the python 
integration in MacCvs is still rather shallow, so I may not know what 
I'm talking about here :( )

Regarding the different Python versions: I assume it's all about which 
headers I include, right? I now remember that I'm probably linking 
against the 10.2.8 SDK, so that would make me include 10.2 Python 
distribution headers. I'll check this... Could this be the problem? 
Could Tkinter fail to load when some python module is loaded that was 
compiled against the old headers?
Do you know of any other environment variable to enable more debug 
output about the loading of modules?

>
> So In fact I don't know...
>
> alex.
>
> At 12:32 PM 4/1/2004, Jack Jansen wrote:
>
>> 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


</jum>




More information about the Pythonmac-SIG mailing list