[Tutor] Working Directory
Russell Bungay
rab121@york.ac.uk
Fri, 03 May 2002 10:58:00 +0100
Hello,
Just before I start, thankyou everyone, I have been reading Tutor for
months now, and have extracted much useful information from it, groovy.
I am currently working on a little app and am having difficulties with
finding out about what directory I am working in. I need this
information for two reasons, 1. for the creation and use of a
ConfigParser object and related file. 2. To import a module held in the
same directory as the module that I am currently working on.
I am aware 2. is not a pretty reason for using this information, I
should be sticking the imported module somewhere more sensible, using
packages for example, but I haven't read up on such things yet (my shiny
new copy of Programming Python came in the post yesterday), and thought
that as I needed the same stuff for 1. I might as well reuse it.
Solutions then:
os.getcwd() won't always return the directory in which my main module is
hiding.
I don't want to hard code the directory in, for obvious reasons.
I can't think of a way in which passing the directory as an command line
argument will guarantee precision.
I am perhaps missing the obvious function that will tell what I need?
All help gratefully received :o)
Thankyou very much,
Russell
--
http://www.bigmaddrongo.com
President of York University Trampoline Club:
http://york.trampolining.net
Chair of The York Glee Singers:
http://www.gleesingers.co.uk