24 Apr
2001
24 Apr
'01
3:55 p.m.
Wouldn't you want to use os.path.join() to retain OS-independence?? e.g. filename = os.path.join('c:\\', 'temp', 'testfile.txt')
From: "Thomas B. Passin" <tpassin@mitretek.org> Date: Tue, 24 Apr 2001 10:48:19 -0400 To: <zope@zope.org> Subject: Re: [Zope] Creating files on server
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