[Zope] [Python/Zope]how to open a "File"
Andreas Jung
lists at andreas-jung.com
Wed Nov 5 01:53:23 EST 2003
This is an FAQ!
PythonScripts run in a restricted environmenet and you have no chance
to access the filesystem through TTW code. Use an external method
instead.
-aj
--On Mittwoch, 5. November 2003 7:35 Uhr +0100 "Rakotomandimby M. A."
<mrakotom at free.fr> wrote:
> Hi all ,
> I'm running Zope 2.6.2 (binary) on a Linux box.
> I FTP-uploaded to the server (into the Site root) a file named "foo".
> The file has been added as a File Object ( no problem for that ) .
> This file content a single line ended by a '\n' , wich is an IP address(
> no problem for that either )
> I wrote a very simple python Script that should return the line inside
> that file _without_ the final '\n' :
>
> import string
> fichier = open('ancienne_ip','r')
> ip = fichier.readline()
> ip = string.strip(ip)
> return ip
>
> the problem is that i got error for this :
>
> Error Type: NameError
> Error Value: global name 'open' is not defined
>
> What did i do wrong ?
> Thnak you .
>
>
>
> _______________________________________________
> Zope maillist - Zope at 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 )
More information about the Zope
mailing list