[Zope] Re: How to break up an external method over multiply source files

Tres Seaver tseaver at zope.com
Tue Apr 19 09:54:35 EDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andreas Jung wrote:

| --On Dienstag, 19. April 2005 11:25 Uhr +0200 Lucas Hofman
| <lucas.hofman at pgs.com> wrote:
|
|> I have an external method a.py (in $INSTANCE_HOME/Extensions) that
|> becomes to big to be in one python file.
|>
|> I have put some functions in b.py (also in
|> $INSTANCE_HOME/Extensions) and want to use them from a.py. However
|> 'import b' in a.py does not work.
|
| *Why* isn't it working? Errors? Tracebacks?

The file from which an ExternalMethod is instantiated is neither a
script nor a module, which means that Python's import rules don't work
for it.

In response to the original question:  I would put the 'b.py' file
somewhere on the PYTHONPATH ($INSTANCE_HOME/lib/python would be a good
choice);  'import b' will then work as expected.


Tres.
- --
===============================================================
Tres Seaver                                tseaver at zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCZQ2aGqWXf00rNCgRAtD/AKCC8E0O0mMEEF2eW0AGXf1aofWopgCfZIHr
xvjVCTq8SS2IxRntZv77BbM=
=0f3g
-----END PGP SIGNATURE-----



More information about the Zope mailing list