Python (windows) will open files from command line, but not from a script launched from eclipse
- by Blake
I'm pretty new to writing python for windows (linux is no problem), and am having problems getting python to recognize files when running scripts, though it behaves fine in the command line
What am I doing wrong here?
def verifyFile(x):
#
return os.path.isfile(x)
This will return true (with a valid file, of course) when called from the python command line, but when I run the script from eclipse, or launch it from windows, it ALWAYS returns false. Any thoughts on why this is?
I've tried passing pathnames like this:
D:\Documents and Settings\BDE\Desktop\cdburn.jpg
and like this:
D:/Documents and Settings/BDE/Desktop/cdburn.jpg
I've changed sys,argv[0] to ''
I've tried this:
def verifyFile(x):
#
try:
f = open(x, 'r')
f.close()
return True
except:
return False
and am getting no love!
Any help would be appreciated.
Thanks
Blake