[Tutor] Variables in Os Path ?
glidedon
glidedon <glidedon@c-zone.net>
Thu Jan 30 02:26:01 2003
Hi list,
Newbie here, What am I doing wrong here ? When I try to insert my variable
"file_name" into the path to open a file I get the error at bottom. The path
is correct if I insert the acutal file name . BTW this on a BeOS system, if
you don't recognise the path format :-)
TIA
Don
import os
/snip/
file_query = raw_input( ' Do you have a log already started ? : y/n ' )
if file_query in ( 'y', 'Y', 'Yes' ):
file_name = raw_input ( ' Enter file name : ')
file = open('/boot/home/py/file_name' , 'r')
history_list = file.readlines()
file.close()
for eachline in history_list:
print eachline,
/snip/
Traceback (most recent call last):
File "/boot/home/py/IOFile/File_Query.py", line 11, in ?
file = open('/boot/home/py/filename' , 'r')
IOError: [Errno -2147459069] No such file or directory: '/boot/home/py/
filename'