how to open a file out of Zope and write into it?
hello everyone! I want to open a file out of Zope and write something into it,and I have done one program Python, but the error message is: global name 'open' is not defined. I don't known why. would you please help me? thank you! this is my program python ----------- request = container.REQUEST RESPONSE = request.RESPONSE fd=open('c:/file.txt', 'w') fd.write('hello') fd.close()
On Wed, 18 Jun 2003 18:01:01 +0300 GMT (..17:01 where i live(GMT+2) ) leiz@esiee.fr asked the Zope mailinglist about the following:
hello everyone!
I want to open a file out of Zope and write something into it,and I have done one program Python, but the error message is: global name 'open' is not defined. I don't known why. would you please help me? thank you!
this is my program python
request = container.REQUEST RESPONSE = request.RESPONSE
fd=open('c:/file.txt', 'w') fd.write('hello')
fd.close()
If you try doing this in a script(python) it will fail. The through-the-web-scripts are restricted security-wise. You need to use an external method to modify files on the filesystem http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/ScriptingZope.st... -- Geir Bækholt
For security reasons, python scripts (the ones created in the ZMI) do not have access to the file system. You must either use an External Method or a Product (both of which are python programs, but require access to the host file system to create and install). Perhaps you can use the Local File System (LocalFS) or External File System products. Whether they will do the job depends upon wht you are trying to accomplish. On Wed, 18 Jun 2003 leiz@esiee.fr wrote:
hello everyone!
I want to open a file out of Zope and write something into it,and I have done one program Python, but the error message is: global name 'open' is not defined. I don't known why. would you please help me? thank you!
this is my program python ----------- request = container.REQUEST RESPONSE = request.RESPONSE
fd=open('c:/file.txt', 'w') fd.write('hello')
fd.close()
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Dennis Allison -
Geir Bækholt -
leiz@esiee.fr