beginners Q: CGI and file paths

Jeremy Maziarz jmaziarz at linus.mitre.org
Mon Jun 14 21:56:24 CEST 1999


John,

$ pwd
/afs/rcf/user/jmaziarz

$ python
>>> outFile = '/tmp/temp.out'
>>> output = open(outFile, 'w')
>>> output.write('This is my first test...\n')
>>> output.close()

$ more /tmp/temp.out
This is my first test...

$ python
>>> outFile = '/tmp/temp.out'
>>> output = open(outFile, 'a')
>>> output.write('This is my second test...\n')
>>> output.close()

$ more /tmp/temp.out 
This is my first test...
This is my second test...

$ python
>>> outFile = '/tmp/temp.out'
>>> output = open(outFile, 'w')
>>> output.write('This is my third test')
>>> output.close()

$ more /tmp/temp.out 
This is my third test 

Try using single quotes? 
-Jer


Mr J Littler wrote:
> 
> Hi,
> I've written a cgi script that outputs a couple of files.
> The default placement is in the cgi-bin directory and
> I want them to go elsewhere. I've tried ...
> 
> filename = "/proper_path_here/c_list.html"
> append = open(filename, 'a')
> 
> but putting the path in front of the filename makes no
> difference (and doesn't generate an error)
> I read thro cgi.py but can't see what to do.
> Any help appreciated...
> Cheers
> John
> --
> jlittler at silas.cc.monash.edu.au
> http://jlittler.cjb.net
> http://linuxmusic.cjb.net




More information about the Python-list mailing list