[Scheck, Garth]
I am trying to create an external method in Zope that links to a method in a Python script called "db." The Python script "db" imports another Python script I created called "GDAC". Both Python scripts are located in the Zope site's Extensions directory. When I try to save the changes on the external method I get an import error saying that it cannot find module "GDAC." Should GDAC be located in a different directory? What is the search path for imports within Zope? NOTE: This script works fine in PythonWin.
I recommend keeping your working code out of the Extensions directory. Just keep files to be called from Zope as external methods, and those files should do nothing more than dispatch to a module somewhere else. Otherwise you can end up with a real jumble in Extensions, especially since you can't use subdirectories there. Nowadays I normally set the path to those files using a .pth file, which you would put in the same directory as the python executable (on Windows, anyway, I'm not sure about *nix - the Python docs will tell you). Zope has its own copy of Python, so you would want to put a copy of the .pth file in both the Zope and your regular installation. You could set a global pythonpath environmental variable, but then you couldn't use different module versions with different python versions (e.g., Python 1.5.2 and 2.2b). You could use a pythonpath variable defined just in your Zope session, but then you have to modify the batch file that starts Zope. So the .pth files work best for me. Cheers, Tom P