[Zope] Creating files on server
Thomas B. Passin
tpassin@mitretek.org
Tue, 24 Apr 2001 10:48:19 -0400
Remember, the '\' is an escape character in Python. You need to double it
when you embed it in a string, like so:
filename='c:\\temp\\testfile.txt'
Or you can use the raw string syntax:
filename=r'c:\temp\testfile.txt'
I don't know if a Zope Python script supports the raw syntax, but I doubt if
it will let you write a file to the filesystem. An external method is no
doubt what you want.
Cheers,
Tom P
Gitte Wange asked -
>
> I have tried the following:
> I added a script(Python):
> argument list: server, mediafile, tcin, tcout, id, clipname
>
> The code looks like this:
> fil = open("/root/Real/Content/" + id + clipname + ".smil", 'w') #Open
> file
> text = "<smil>\n\t<body>\n\t\t<audio src=\"rtps://" + server + "/" +
> mediafile + " clip-begin=\"" + tcin + "\" clip-end=\"" + tcout +
> "\">\n\t</body>\n\n</smil>"
> fil.write(text)
> fil.close()
>
> Now when running this script I get a NameError on "open".
> What is wrong ?
>