Message125827
The following code is being used to work around this issue for Python 2.x in Tahoe-LAFS:
# This works around <http://bugs.python.org/issue2128>.
GetCommandLineW = WINFUNCTYPE(LPWSTR)(("GetCommandLineW", windll.kernel32))
CommandLineToArgvW = WINFUNCTYPE(POINTER(LPWSTR), LPCWSTR, POINTER(c_int)) \
(("CommandLineToArgvW", windll.shell32))
argc = c_int(0)
argv_unicode = CommandLineToArgvW(GetCommandLineW(), byref(argc))
argv = [argv_unicode[i].encode('utf-8') for i in range(0, argc.value)]
if not hasattr(sys, 'frozen'):
# If this is an executable produced by py2exe or bbfreeze, then it will
# have been invoked directly. Otherwise, unicode_argv[0] is the Python
# interpreter, so skip that.
argv = argv[1:]
# Also skip option arguments to the Python interpreter.
while len(argv) > 0:
arg = argv[0]
if not arg.startswith("-") or arg == "-":
break
argv = argv[1:]
if arg == '-m':
# sys.argv[0] should really be the absolute path of the module source,
# but never mind
break
if arg == '-c':
argv[0] = '-c'
break |
|
Date |
User |
Action |
Args |
2011-01-09 07:36:55 | davidsarah | set | recipients:
+ davidsarah, loewis, christian.heimes, giovannibajo, benjamin.peterson |
2011-01-09 07:36:55 | davidsarah | set | messageid: <1294558615.21.0.00860554810313.issue2128@psf.upfronthosting.co.za> |
2011-01-09 07:36:51 | davidsarah | link | issue2128 messages |
2011-01-09 07:36:51 | davidsarah | create | |
|