[IronPython] Two Problems with sys.argv and compiled scripts

Bruce Bromberek bruce.bromberek at gmail.com
Mon Mar 23 22:14:57 CET 2009


Problem #1
I know this is a know issue, but my google-fu has been able to uncover the
solution.  When I compile my script into an exe , sys.argv get sets to ' '.

Using SharpDevelop and Ironpython 2.0.1

#Program.py
#
import clr
clr.AddReference('mscorlib')
clr.AddReference('System')
import sys
import System

if __name__ == 'Program':
    try:
        print "sys.argv = ",sys.argv
    except System.Exception, e:
        print e

yeilds output of
C:\Program Files\IronPython 2.0.1\Samples\pyc>Program.exe fred
sys.argv =  ['']

instead of the expected
sys.argv['fred']

Problem #2:

If I drag and drop a file onto the exe, I get a exception message that I
can't see.  In IronPython 1.0, the dropped file would populate sys.argv

Hopefully someone can answer or direct me to better source.

-WombatPM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090323/af1239bb/attachment.html>


More information about the Ironpython-users mailing list