Are you invoking the script like C:\>python myscript.py
? If so, then your script will actually be running under the python program, which means its location will be wherever your python executable it, not the script. You can verify this by importing os
and running os.getcwd()
, which will probably show something like 'C:\\Python33'
.
To fix this, either invoke your script directly by doing C:\myscript.py
(this works just finel; Windows knows which interpreter to use based off of the extension), use os.chdir()
to fix your location in the file system, or just use absolute pathing.