[Tutor] Re: Tutor Digest, Vol 6, Issue 83
David Holland
davholla2002 at yahoo.co.uk
Mon Aug 23 22:01:15 CEST 2004
> 1. Re: Problems with changing directory.
> (Dragonfirebane at aol.com)
Thanks everyone for the help :-
I changed it (after importing traceback) :-
def change_dir():
y = '/home/david/Documents/pyprogamming/test/'
try:
os.chdir(y)
print "line 53"
list_of_files = os.listdir(y)
print "line 55"
for file in list_of_files:
print "line 57"
linesone = open_files(file)
getlineinfo(linesone)
print file
print "Directory", y,"does exist"
except:
print y, "does not exist"
traceback.print_exc()
And now I get the same error and the traceback :-
'OSError: [Errno 2] No such file or directory'
Basically I wrote the directory wrong I should have
done it like this :-
y = '/home/david/Documents/pyprogramming/test'
(ie no slash at the end)
Thanks for the help.
___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com
More information about the Tutor
mailing list