[Zope] Python/DBI/ODBC/Zope

Schmidt, Allen J. aschmidt@nv.cc.va.us
Fri, 6 Jul 2001 12:25:38 -0400


There is a version of dbi.dll that lives in ZOPE/bin/lib/win32
We can run this from the command line while in the EXTENSIONS folder of the
Zopesite.
How can we tell Zope to run using the one from inside itself? And not the
one in the Python20/win32 folder?
I moved the dbi.dll from bin/lib/win32 and it makes no difference.

How does Python see the file to import if it is only a a DLL file?

-----Original Message-----
From: Thomas B. Passin [mailto:tpassin@mitretek.org]
Sent: Friday, July 06, 2001 10:42 AM
To: zope@zope.org
Subject: Re: [Zope] Python/DBI/ODBC/Zope


[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


_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )