[stuffduff]
I have a python external method which reads from an external database, unpickles a class object, and concatenates some of the object's properties into a string which is returned by the external method. The class definition is included in the module.
When I run it from the linux prompt in the Extensions directory it behaves exactly as it should. The class is successfully unpickled, the properties are read and the string is returned.
However, when I set it up as an external method and call it I get the infamous:
Without knowing how you have defined things, this might not be it, but the most likely cause of problems like this is the Python path. When you run the module from the command prompt, in the Extensions directory, you are probably using your ordinary Python installation, and the Extensions directory will be on the Python path because it is the cwd when you launched Python. When you run from Zope, you use Zope's Python interpreter, which uses a different Python path, and Extensions may not be on it. When I run external methods, I always put all the real code in a package somewhere else, outside of the Zope directory tree, and add that location to Zope's Python path, usually using a *.pth file. The method in the Extensions directory just imports my package and then calls something in it, no more. This has always worked well for me and is easy to set up. Cheers, Tom P
participants (1)
-
Passin, Tom