[Zope] RE: Importing Products into my Custom Product....

Dave Kuhlman dkuhlman at cutter.rexx.com
Sat Sep 11 15:54:46 EDT 2004


On Sat, Sep 11, 2004 at 11:52:16AM -0700, Bill Hewitt wrote:

[snip]

> "import Bar" into my __init__.py file for "FOO"
> 
> When I do this, the ZServer complains that the module does not
> exist..... So, I try:
> "from Bar import Bar" and "from Bar.Bar import Bar" and "from
> Products.Bar import Bar"
> 
> Again the ZServer complains that the module does not exist -even though
> they *do* exist right next to each other in the same "Products"
> Directory.....
> 
> How do I get one product to use (reuse) the methods of another product
> that also exists in the "Products" Directory?

I don't know anything specific about Zope products, but it sounds
like a standard import problem.

You might print or inspect the contents of sys.path.  For example:

    import sys
    print sys.path

sys.path is a list of the places you can import things from.  Then,
if the path you need is not there, do the following before
importing:

    sys.path.append("/a/path/to/the/instance/Products")

or:

    sys.path.insert(0, "/a/path/to/the/instance/Products")

Hope this helps.

Dave

-- 
Dave Kuhlman
http://www.rexx.com/~dkuhlman


More information about the Zope mailing list