beno wrote at 2003-1-11 16:32 -0400:
I'm calling a function with a file name from an external method. I need to pass a variable to the method, so I have a line like this:
<dtml-var expr="externalMethod('file')">
but the error comes back thus:
IOError: [Errno 2] No such file or directory: 'file' Apparently, you are using Python's "open" function (or friend). It resolves relative filenames with respect to the "currend working directory". The "current working directory" must not change during Zope execution. Especially, it can not be dependent on the location of an "External Method" or DTML object.
I am not sure, what Zope's current working directory is. I expect it is the directory where Zope has been started. But, there are rumors that this may have been changed and the current working directory is now "CLIENT_HOME" (per default the "var" subfolder). Either use absolute path names to your files or find out what the current working directory is (Python has an function for thin in the "os" module) and use relative filenames with respect to this directory. Dieter