On 18/10/2013 13:02, telconsta...@gmail.com wrote: > Hey John, > > Thanks for the response. I really don't know why I didn't think about that. I > decided to add the following statement: > > print root > > When I RUN, this is what I get: > C:\My Documents\Netbeans\Mytests > > When I debug, this is what I get: > C:\Program Files > > Having these two directories as different directories is a problem. Any > thoughts on how to detect the runtime CWD? C:\Program Files is a pretty > unhelpful CWD.
import os xxx = os.getcwd() will fetch the current directory. Similary, you can change it with os.chdir() It is usually better to do one of two things: 1) make the environment set the current directory - fix the debugger 2) use absolute paths throughout the code. One reason that chdir() is discouraged is that it's not clear what part of the code will still be using the original cwd, even though you think you've changed it. For example, I don't believe that sys.path is re-evaluated. Another reason is that on Windows, you have the strange characteristic that there are multiple current directories, one per drive. Most IDE's can set the current directory in the project settings, so that it'll always be the same when you run a given program. I don't know about Netbeans. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list