[IronPython] Dirstributing scripts as Exe

David DiCato ddicato at microsoft.com
Fri Apr 30 19:41:10 CEST 2010


These assemblies should automatically be loaded by the CLR before the IronPython engine is ever started. If you're able to execute "import clr", then they have already been loaded successfully.

The purpose of clr.AddReference is to make assemblies available from Python, so it is only necessary if the Python code itself calls into these DLLs.

One finer point: System and mscorlib are special because IronPython adds references to them by default. At some point in the past, pyc.py failed to add these references by default, which broke any pyc-compiled scripts that tried to call into these DLLs (e.g. "import System"). As a workaround, we recommended including clr.AddReference('System') and clr.AddReference('mscorlib') at the beginning of such pyc-compiled scripts, but this is no longer required because the bug has been fixed.

- David

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Bruce Bromberek
Sent: Thursday, April 29, 2010 4:18 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Dirstributing scripts as Exe

You also have to watch that the IronPython automatically loads some assemblies that pyc does not.  It may be overkill but I reference the following in every script I make into an exe.

#Key IronPython References needed for final EXE when IronPython is not installed
clr.AddReference('IronPython')
clr.AddReference('IronPython.Modules')
clr.AddReference('Microsoft.Dynamic')
clr.AddReference('Microsoft.Scripting')
clr.AddReference('Microsoft.Scripting.Core')
clr.AddReference('Microsoft.Scripting.Debugging')
clr.AddReference('Microsoft.Scripting.ExtensionAttribute')
clr.AddReference('mscorlib')
clr.AddReference('System')
clr.AddReference('System.Data')


On Thu, Apr 29, 2010 at 5:13 PM, David DiCato <ddicato at microsoft.com<mailto:ddicato at microsoft.com>> wrote:
This is probably an assembly load failure. Try copying "c:\Program Files\IronPython 2.6"\*.dll into your program directory. You will also need to make sure that sys.path is properly set if you're using the CPython standard lib for anything.

We realize this is kind of an undesirable workaround, which is why we're planning to put all of IronPython's required DLLs in the GAC at some point in the future.

- David

-----Original Message-----
From: users-bounces at lists.ironpython.com<mailto:users-bounces at lists.ironpython.com> [mailto:users-bounces at lists.ironpython.com<mailto:users-bounces at lists.ironpython.com>] On Behalf Of Mico Siahaan
Sent: Thursday, April 29, 2010 3:04 PM
To: Users at lists.ironpython.com<mailto:Users at lists.ironpython.com>
Subject: [IronPython] Dirstributing scripts as Exe

Dear all,

In CPython there is py2exe to distribute scripts as exe. I notice
there is pyc.py scripts in IronPython\Tools. I tried to use pyc to
compile one simple script. It produced an exe file. But when I tried
to run the exe file, Windows complained: 'Windows stop working...'.
Did I do something wrong?

--
Mico | mico.siahaan at gmail.com<mailto:mico.siahaan at gmail.com> | @bangmico
_______________________________________________
Users mailing list
Users at lists.ironpython.com<mailto:Users at lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100430/27bd378a/attachment.html>


More information about the Ironpython-users mailing list