Re: enable_ptl/easy_install problem

"Mike Orr" <[email protected]> Tue, 1 May 2007 12:48:03 -0700
Newsgroups gmane.comp.web.quixote.user
Message-ID <[email protected]>
On 4/30/07, Eddie Corns <[email protected]> wrote:
> $ python
> >>> from quixote import enable_ptl
> >>> enable_ptl()
> >>> import munepy
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ImportError: No module named munepy
> >>>
>
> versus
> $ python
> >>> import munepy
> >>>

You can make a utility script like this:

====
from quixote import enable_ptl
enable_ptl()
import first_ptl_module
import second_ptl_module
# Continue with all .ptl modules
====

If you run this every time you modify the .ptl's, it will update all
the .pyc's, and then you can avoid using enable_ptl() at all in your
application.

Import hooks are fragile in Python, and often break when combined with
import hooks from other packages.  That's why they must be enabled in
a certain order; e.g., PTL after ZODB.  I can't remember which other
packages have import hooks.  Cheetah has an optional one though I've
never used it.

-- 
Mike Orr <[email protected]>