[Zope] Python/DBI/ODBC/Zope
Thomas B. Passin
tpassin@mitretek.org
Fri, 6 Jul 2001 10:42:04 -0400
[Schmidt, Allen J]
> We have a Python program that reads a URL, rips it apart and dumps the
> pieces into an ODBC connected database. Works fine from the command line.
>
> If we try to add this into Zope as an External Method, it states it cannot
> find the dbi component. import dbi uses a dbi.dll in Windows.
>
> This was developed on 2.1 Python but the dbi module exists in Zopes 1.52
> Python so I am not sure where the problem is.
>
>
Your development installation of python probably has a different python path
than the Zope installation, that's why it isn't being found. You need to
add its location to the python path that Zope uses, one way or another.
Use its location in you development tree as a guide,a nd try to put in in
the equivalent location in Zope.
You can add to the Zope search path by:
1) Adding a set pythonpath=... statement to the batch file that starts Zope
2) add a xxx.pth file to the Zope python directory - put the path to the
file on a single line in the .pth file
3) Hack z2.py to add the path to sys.path
Or you can try copying the file to the python library directory where other
similar files already live. Of course, what you do will depend on how the
existing code specifies the location of the dbi.dll, but this should be
enough for you to work it out.
One final possibility is that Zope is finding the version compiled for
Python 2.1. You would get some kind of an import error if that happens.
You have to make sure that your external method is using the version
compiled for Python 1.5.2.
Cheers,
Tom P