[Zope] python script trouble?

Dylan Reinhardt zope at dylanreinhardt.com
Wed Nov 12 11:10:11 EST 2003


On Wed, 2003-11-12 at 06:20, Kate Legere wrote:
> I am calling a python script 'addToFile' from a dtml method:
> <dtml-call expr="addToFile()">
> 
> the script is meant to open a pre-existing file and write to it:
> 
>    f=open('file1', 'wt',1)
>    f.write('hello')
>    f.close
> 
> At the moment I am just writing a test to see if it works and, it doesn't.
> I get, when I view the calling dtml method,
> 
>     Error Type: NameError
>     Error Value: global name 'open' is not defined
> 
> I have looked through the Python bible and am at a loss to think where I
> have erred.

Python Scripts can't access the file system.  

You can use an external method for this and there are a handful of
third-party products for accessing the file system. 

HTH,

Dylan




More information about the Zope mailing list