[Zope-DB] Can't get DCOracle2 to work with Python in Zope
Kent Hoxsey
khoxsey at earthlink.net
Tue Nov 4 13:21:40 EST 2003
> If I try to use DCOracle2 in a Zope Python script, it fails at the
> 'import DCOracle2' line. If I try it in an External Method, it fails
> at the connection string line with 'DCOracle2 has no connect attribute'.
When I've had this problem, it was because I was not including the library
correctly. DCOracle2 is installed in the Products directory, and Zope (and
the DA) know where to find everything.
I have never tried to create a database connection from a Python script, so
I'm not sure the security mechanisms allow it. But my understanding of the
way Python scripts are handled suggest that is a bad place to do database
connectivity because of the extra security context checking.
The problem in External Methods is likely a namespace issue. Try something
like:
from DCOracle2 import DCOracle2
dbconn = DCOracle2.connect("....")
or
from Products import DCOracle2
dbconn = DCOracle2.DCOracle2.connect(...)
It's been a while since I did that, but something like that did work.
Kent
More information about the Zope-DB
mailing list