Re: [Pythonmac-SIG] Namespace conflict with WebWare and PyObjC / Import safety (Was: how do I use twisted cfreactor?)

2005-01-15 Thread Bob Ippolito
On Jan 14, 2005, at 17:57, Bob Ippolito wrote:
On Jan 14, 2005, at 17:14, Bob Ippolito wrote:
On Jan 14, 2005, at 16:56, Kevin Dangoor wrote:
Bob Ippolito wrote:
(Kevin sent me the test off-list, and I took a look at it).
I'm not sure exactly why your example crashes (somehow a retain  
message gets sent to a dead or non-object), however, the problem is  
that you are using an import statement from inside the  
implementation of the action.  Don't do that.  Do your imports in  
module level code.
Wow. That was quick!
I didn't realize that there was a gotcha with the imports. That was  
just a premature optimization, so I can easily avoid that :)

Thanks for your help... that's certainly not the kind of thing I  
would have just guessed...
I don't think there is typically a gotcha with imports, I've  
certainly never seen this happen before, and I have done imports from  
applicationDidFinishLaunching: (pygame, in particular) before.  I  
have no idea if I should be blaming Cheetah, PyObjC or Python 2.3.0  
(haven't tested with 2.4 or CVS), but I will try and remember to dig  
in later.
I have traced the problem.  It is a two-parter:
(1) There is a module namespace conflict:
WebWare has a package named WebKit
PyObjC has a package named WebKit
(2) Cheetah.Servlet checks to see if WebWare's WebKit is available,  
and ends up importing PyObjC's WebKit.

(3) For whatever reason, it is not safe to import the WebKit wrapper  
from inside of an action (unless it's already imported, of course).   
Now this issue I will have to look further into.

---
So apparently it's more or less undefined behavior if you have both  
WebWare and PyObjC installed!  Fun :)
I've filed a bug against WebWare  
http://sourceforge.net/tracker/index.php? 
func=detailaid=1102868group_id=4866atid=104866, hopefully they'll  
change the name of WebKit, I don't think we will do it in PyObjC --  
because then we'd have to change the names of every wrapped framework  
for consistency.

The actual crash is due to the fact that WebKit/__init__.py recycles  
the PyObjC global autorelease pool.  God knows why.  I've reverted this  
behavior in svn trunk r1337.

-bob
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Namespace conflict with WebWare and PyObjC / Import safety (Was: how do I use twisted cfreactor?)

2005-01-15 Thread Jack Jansen
On 14-jan-05, at 23:57, Bob Ippolito wrote:
I have traced the problem.  It is a two-parter:
(1) There is a module namespace conflict:
WebWare has a package named WebKit
PyObjC has a package named WebKit
As far as I know this is the first time this potential problem with 
python's naming convention is seen in the wild. Maybe it's worth it to 
report it to python-dev?
--
Jack Jansen, [EMAIL PROTECTED], http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma 
Goldman

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pyobjc-dev] Re: [Pythonmac-SIG] Namespace conflict with WebWare and PyObjC / Import safety (Was: how do I use twisted cfreactor?)

2005-01-15 Thread Bob Ippolito
On Jan 15, 2005, at 18:26, Jack Jansen wrote:
On 14-jan-05, at 23:57, Bob Ippolito wrote:
I have traced the problem.  It is a two-parter:
(1) There is a module namespace conflict:
WebWare has a package named WebKit
PyObjC has a package named WebKit
As far as I know this is the first time this potential problem with 
python's naming convention is seen in the wild. Maybe it's worth it to 
report it to python-dev?
Well I filed a bug with Webware, let's wait a couple days and see if 
they say anything.

-bob
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


[Pythonmac-SIG] Namespace conflict with WebWare and PyObjC / Import safety (Was: how do I use twisted cfreactor?)

2005-01-14 Thread Bob Ippolito
On Jan 14, 2005, at 17:14, Bob Ippolito wrote:
On Jan 14, 2005, at 16:56, Kevin Dangoor wrote:
Bob Ippolito wrote:
(Kevin sent me the test off-list, and I took a look at it).
I'm not sure exactly why your example crashes (somehow a retain 
message gets sent to a dead or non-object), however, the problem is 
that you are using an import statement from inside the 
implementation of the action.  Don't do that.  Do your imports in 
module level code.
Wow. That was quick!
I didn't realize that there was a gotcha with the imports. That was 
just a premature optimization, so I can easily avoid that :)

Thanks for your help... that's certainly not the kind of thing I 
would have just guessed...
I don't think there is typically a gotcha with imports, I've certainly 
never seen this happen before, and I have done imports from 
applicationDidFinishLaunching: (pygame, in particular) before.  I have 
no idea if I should be blaming Cheetah, PyObjC or Python 2.3.0 
(haven't tested with 2.4 or CVS), but I will try and remember to dig 
in later.
I have traced the problem.  It is a two-parter:
(1) There is a module namespace conflict:
WebWare has a package named WebKit
PyObjC has a package named WebKit
(2) Cheetah.Servlet checks to see if WebWare's WebKit is available, and 
ends up importing PyObjC's WebKit.

(3) For whatever reason, it is not safe to import the WebKit wrapper 
from inside of an action (unless it's already imported, of course).  
Now this issue I will have to look further into.

---
So apparently it's more or less undefined behavior if you have both 
WebWare and PyObjC installed!  Fun :)

-bob
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig