[Zope] How to use a ZSQLMethod from a Python Script

Dieter Maurer dieter@handshake.de
Fri, 3 May 2002 19:12:41 +0200


Igor Leturia writes:
 > > >   I want to call a ZSQLMethod from a Python Script. In Zope.org, I
 > > > couldn't find a specific how-to on the subject, but accidentally I
 > found
 > > > some other how-to's in which there are examples that use ZSQLMethods
 > > > from Python scripts. It seemed very easy, so I tried it that way:
 > > > 
 > > >     res = context.mysqlmethod()
 > > > 
 > > >   It gives an error message, 'resource not found'. Both the 
 > >script and
 > > > the sql method are in the same folder. What's going wrong?
 > ....
 > 
 > This is the traceback when running in debug mode:
 > Traceback (innermost last):
 >   File C:\Intranet\lib\python\Zope\__init__.py, line 221, in
 > zpublisher_exception_hook
 >     (Object: Traversable)
 >   File C:\Intranet\lib\python\ZPublisher\Publish.py, line 173, in
 > publish
 >   File C:\Intranet\lib\python\ZPublisher\HTTPResponse.py, line 308, in
 > setBody
 >   File C:\Intranet\lib\python\ZPublisher\HTTPResponse.py, line 547, in
 > notFoundError
 > NotFound: (see above)
Either this tranceback comes from a secondary problem (not very likely)
or it did not happen in your python script at all.
Are you sure, your URL is correct?

Furthermore, are you sure, this is debug mode.
When I get similar errors (debug mode), I see:

 : Cannot locate object at: http://localhost:8080/Haufe/Partner/Logos/cccc
 : ....
 : 
 :   File /home/dieter/Haufe/src/Zope/lib/python/ZPublisher/BaseRequest.py, line 308, in traverse
 :   File /home/dieter/Haufe/src/Zope/lib/python/ZPublisher/HTTPResponse.py, line 482, in debugError
 : NotFound: (see above)




Dieter