[Zope] import from a product's Extensions
Mitchell L Model
mlm@acm.org
Sun, 16 Sep 2001 16:50:44 -0400
At 2:57 PM -0400 9/16/01, marc lindahl wrote:
>How about
>from Extensions import Utils
>
>or
>from Extensions.Utils import *
>
>since you're running in the Prod directory already...
I should have been clearer:
1. I start up pdb from the lib/Python directory
2. My external methods are in my product's Extensions directory,
lib/python/Products/Prod/Extensions
So, your suggestions aren't quite right, but for some reason they
twisted something
in my brain and I realized that I didn't have an __init__.py in my
Extensions folder, so it wasn't recognized as a module. (Normally
you wouldn't need an __init__.py in the directory because you never
do import it -- the Zope external method mechanism can find it
anyway. So it didn't occur to me to put one there. But if I want to
call my external methods directly from pdb without going through the
Zope external method mechanism (which I could also do in pdb), I have
to import the files, and therefore need a __init__.py in my
Extensions folder.
Thanks for the response.
>
>> From: Mitchell L Model <mlm@acm.org>
>> Date: Sun, 16 Sep 2001 14:36:56 -0400
>> To: zope@zope.org
>> Subject: [Zope] import from a product's Extensions
>>
>> While debugging in pdb I want to experiment with some Python methods
>> in my product's Extensions folder. I can import modules from my
>> product directory, but I can't figure out how to import from my
>> product's Extensions directory. Given a product named Prod and a
>> file Utils.py in Extensions, none of the following work:
>>
>> import Prod.Extensions.Utils
>> import Prod.Utils
>> import Products.Prod.Extensions.Utils
>> import Products.Prod.Utils