27 lines
636 B
Plaintext
27 lines
636 B
Plaintext
From: jbauer at rubic.com (Jeff Bauer)
|
|
Date: Thu, 22 Apr 1999 11:45:22 GMT
|
|
Subject: Directory of current file
|
|
References: <Pine.WNT.4.05.9904212159220.191-100000@david.ski.org>
|
|
Message-ID: <371F0BD2.7D40A957@rubic.com>
|
|
X-UID: 982
|
|
|
|
David Ascher wrote:
|
|
> Tip: To find out the directory of the currently executing program, use:
|
|
>
|
|
> import sys, os
|
|
> if __name__ == '__main__':
|
|
> _thisDir = ''
|
|
> else:
|
|
> _thisDir = os.path.split(sys.modules[__name__].__file__)[0]
|
|
|
|
David, what are the advantages over this?
|
|
|
|
_thisDir = os.path.split(sys.argv[0])[0]
|
|
|
|
Jeff Bauer
|
|
Rubicon, Inc.
|
|
|
|
|
|
|
|
|