Python thinks file is empty

loial jldunn2000 at googlemail.com
Mon Nov 5 10:19:42 EST 2007


I am writing a file in python with writelines

f = open('/home/john/myfile',"w")
f.writelines("line1\n")
f.writelines("line2\n")
f.close()

But whenever I try to do anything with the file in python it finds  no
data. I am trying ftp, copying the file...the resultant file is always
0 bytes, although if I look at the original file on the unix command
line, its fine

e.g.

shutil.copyfile('/home/john/myfile', '/home/john/myfile2')


Any ideas what the problem is?




More information about the Python-list mailing list