exists=false, but no complaint when i open it!?
Tim Golden
mail at timgolden.me.uk
Thu May 15 12:09:19 EDT 2008
globalrev wrote:
> print os.path.exists('C:\Users\saftarn\Desktop\NetFlixDataSet
> \trainingsetunzipped\training_set\mv_0000001.txt')
>
> d=open('C:/Python25/myPrograms/mapexperiments/maps/provinces-of-
> sweden.gif')
> d.close()
Ummm. These are not the same files (unless you've got some bizarre
NTFS linking going on).
> exists returns false but when i open it doesnt complain. how come?
Also, in general, you're prone to race conditions if you do this
kind of thing, altho' on a local C: drive that's less likely. But
still possible. Probably better to wrap the open in a try-except
and handle an IOError.
TJG
More information about the Python-list
mailing list