[IronPython] Values of sys.argv do not show when .exe IP program is executed.

Martin Maly Martin.Maly at microsoft.com
Sat Feb 4 20:07:07 CET 2006


Given the stage of development IronPython is in, IronPython does generate the exes and pdbs as it compiles Python scripts. However, the right way to generate the exes from Python scripts for the long-term is the IronPython.Hosting.PythonCompiler class so I would encourage you to use that as a means to compile scripts to exes.

As you try this, you'll notice that the sys.argv doesn't get handled correctly that way either. It's because the by-product compiled exes share the same code path, so by fixing one, we fix both.

However, even so, using the PythonCompiler is preferred, especially since the by-product generated exes may actually go away at some point, or they may be generated only in some cases (debugging, caching of pre-compiled scripts ...). Another advantage is that the PythonCompiler allows compiling multiple Python scripts into one exe so you actually get better results.

Martin


-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland
Sent: Friday, February 03, 2006 8:50 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Values of sys.argv do not show when .exe IP program is executed.

It's just an oversight - We're not setting sys.argv in PythonEngine.ExecuteCompiled, so we just need to do:

            engine.sys.argv = List.Make(Environment.GetCommandLineArgs());

then you should get the arguments.

Thanks for the report - I'll get a bug opened on it for beta 3.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Paparipote .
Sent: Friday, February 03, 2006 8:44 AM
To: users at lists.ironpython.com
Subject: [IronPython] Values of sys.argv do not show when .exe IP program is executed.

Hello:
I have the next code in a file named test.py:

import sys
for i in sys.argv:
	print i

when running the next command: ironpythonconsole test.py one two three four
It gets:
test.py
one
two
three
four

I could see that IP generates .exe files; it is a good thing. All programs I 
made until now work well when I invoke the .exe ones. In the case of 
test.exe, however, the parameters are not shown when I execute in this way:
$ Test one two three four

$

What is wrong?
Best regards.

_________________________________________________________________
Charla con tus amigos en línea mediante MSN Messenger: 
http://messenger.latam.msn.com/

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



More information about the Ironpython-users mailing list