Hmm, in some cases we don't seem to get our scriptname in argv[0].

Cater for that by working from sys.executable.
This commit is contained in:
Jack Jansen 2002-08-02 15:31:25 +00:00
parent ba1c13db4f
commit 3e6c80bf5e
1 changed files with 13 additions and 2 deletions

View File

@ -9,14 +9,25 @@ import os
import sys
import marshal
#
# Make sure we have an argv[0], and make _dir point to the Resources
# directory.
#
if not sys.argv or sys.argv[0][:1] == '-':
# Insert our (guessed) name.
_dir = os.path.split(sys.executable)[0] # removes "python"
_dir = os.path.split(_dir)[0] # Removes "MacOS"
_dir = os.path.join(_dir, 'Resources')
sys.argv.insert(0, '__rawmain__')
else:
_dir = os.path.split(sys.argv[0])[0]
#
# Create sys.argv
#
argvemulator.ArgvCollector().mainloop()
#
# Find the realy main program to run
# Find the real main program to run
#
_dir = os.path.split(sys.argv[0])[0]
__file__ = os.path.join(_dir, '__main__.py')
if os.path.exists(__file__):
#