Platform-independent way to refer to execute path
What would be the best platform-independent way to refer
to the current (execute) path for a Python script?
self.dirname = ???
This variable should contain directory name for the current path.
It should work on every platform (Linux, Windows...). I'm
not interested in parsing this string. That is, simple
should work, withour ever peeking into the string. Thx,
Re: Platform-independent way to refer to execute path
> What would be the best platform-independent way to refer
> to the current (execute) path for a Python script?
> self.dirname = ???
> This variable should contain directory name for the current path.
The question seems ambiguous to me. What is the "current path"?
There is a PATH environment variable, but you probably don't mean
that. There is also a current directory, or "current working directory",
which is accessible through os.getcwd(). Will that do? If so, make
sure you read the rest of the docs on the "os" module so you'll
know what is there for later.
|All times are GMT. The time now is 04:25 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.