[IronPython] sys.argv empty in compiled scripts

Dino Viehland dinov at microsoft.com
Wed Aug 19 13:07:50 PDT 2009


It is fixed in 2.6.  I don't see another bug on this anywhere else
so the new bug will be good to keep around for 2.0.3.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord
Sent: Wednesday, August 19, 2009 3:44 AM
To: Discussion of IronPython
Subject: Re: [IronPython] sys.argv empty in compiled scripts

Hello,

This is a known bug - and if it isn't fixed in 2.6 it really needs to
be. :-)

You can access the command line arguments through System.Environment.

from System import Environment
args = Environment.GetCommandLineArgs()

HTH

Michael

Howland-Rose, Kyle wrote:
> Hi all,
>
> I just
> http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=24373 to
> report this but I would appreciate a work-around if anyone has one.
> The text of the issue is below.
>
> Thanks for any help!
>
> Regards,
> Kyle
>
> *Description*
> This is like
> http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=12283 but
> seems to refer to a different exe.
>
> I downloaded the pyc in the samples today this problem is still an
> issue - or is an issue again.
>
> In this case sys.argv is empty in compiled scripts. See below for an
> example.
>
> bash-3.2$ ipy
> IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.3053
> Type "help", "copyright", "credits" or "license" for more information.
> >>> ^Z
> bash-3.2$ cat broken.py
> import sys
> print str(sys.argv)
> bash-3.2$ ipy broken.py foo bar
> ['broken.py', 'foo', 'bar']
> bash-3.2$ ipy.exe pyc.py /main:broken.py
> Input Files:
> Output:
> broken
> Target:
> ConsoleApplication
> Platform:
> ILOnly
> Machine:
> I386
> Compiling...
> Saved to broken
> bash-3.2$ ./broken.exe foo bar
> ['']
> bash-3.2$
>
>
>
> ************************************************************************
>
> Allens Arthur Robinson online: http://www.aar.com.au
>
> This email is confidential and may be subject to legal or other
> professional privilege. It is also subject to copyright. If you have
> received it in error, confidentiality and privilege are not waived and
> you must not disclose or use the information in it. Please notify the
> sender by return email and delete it from your system. Any personal
> information in this email must be handled in accordance with the
> Privacy Act 1988 (Cth).
>
> *************************************************************************
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>


--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog


_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


More information about the Users mailing list