[Zope] Creating files on server
Thomas B. Passin
tpassin@mitretek.org
Tue, 24 Apr 2001 12:37:20 -0400
Probably, but the original example used a backslash and I wanted to point
out that it can have special properties. You'd usually want to use relative
paths, anyway, instead of things like "c:\".
Cheers,
Tom P
marc lindahl wrote -
> 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>
> > 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.
> >