Problem embedding Python.
davea at ieee.org
Thu Oct 29 21:53:53 CET 2009
Brandon Keown wrote:
> On Oct 27, 7:48 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
>> Now that you've solved your problem, revise your conclusion. A file
>> without a path *is* searched in the current working directory - but that
>> directory may not be the one you think it is.
>> Gabriel Genellina
> I'm not sure what you mean. I executed the program from the directory
> the file was in, they were in the same directory. And when a program
> executes from a path in CMD in windows, that is supposed to be the
> CWD. I'm not sure what it would be set to if not that...
Gabriel is right. But if you care to get our diagnosis, you need to
state your working conditions more clearly. Or perhaps do a bit of
debugging on it. For a start, you might do a print os.curdir right
before the open() function to see what the current directory is.
Or you could remove the several ambiguities in your paragraph above that
starts "I'm not sure..." Maybe show a transcript of your CMD session.
And if the python.* that's on your PATH is a batch file, show us the
contents of that as well.
And if you're running from CMD, or from an interpreter, or from IDLE, or
from an IDE, or from Explorer, each one may have its own idea of what to
give you for current directory.
If you're running the script from a CMD prompt, by just entering the
script name and letting Windows find the executable (which is not the
script), then you're correct, CWD should be the same as it was in the
More information about the Python-list