finding dir of main .py file
ron.longo
longorh at npt.nuwc.navy.mil
Tue Dec 11 11:08:43 EST 2007
Is there any way that I can find the path of the main .py file of my
application?
For example, I have an application with some resources which are in a
subdirectory:
myPythonApp.py
/resources
image1
image2
etc.
If i just do a call to os.getcwd() I get back the directory I was in when I
typed 'python myPythonApp.py' which could be any directory. What I want is
the directory that contains the file myPythonApp.py. Then I can use this
directory to construct the path to the resources directory.
(Actually, the app I'm writing has several subdirectories with stuff that it
needs such as plugins, configuration files, workspaces, etc.
Thanks for the help.
Ron
--
View this message in context: http://www.nabble.com/finding-dir-of-main-.py-file-tp14277145p14277145.html
Sent from the Python - python-list mailing list archive at Nabble.com.
More information about the Python-list
mailing list