[IronPython] compiling an executable with the standard library
Dino Viehland
dinov at microsoft.com
Tue Jul 13 05:58:26 CEST 2010
Ahh the XAML means you probably have a GUI app... You probably need /target:winexe in the options for compiling the EXE instead of /target:exe. If that doesn't fix it can you attach a debugger when it crashes and get the stack trace?
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Andrew Evans
Sent: Monday, July 12, 2010 3:57 PM
To: Discussion of IronPython
Subject: Re: [IronPython] compiling an executable with the standard library
A quick thought do I need to reference Threading by doing something like "stdlib.Threading" or can I just do from Threading import *
On Mon, Jul 12, 2010 at 3:54 PM, Andrew Evans <evans.d.andrew at gmail.com<mailto:evans.d.andrew at gmail.com>> wrote:
Hell ty for your fast reply.
I compiled the dll using your script. I then did a clr.AddReference in my py code. I also switched to Python 2.6.0. I compiled my code and copied the necessary dlls from my IronPython install to my my executable output directory along with my xaml file.
How ever when I run my app from command "p2pChat.exe" it crashes with no error messages and returns to a shell.
This is the contents of my Directory
p2p/
IronPython.dll
IronPython.Modules.dll
IronPython.Modules.XML
IronPython.XML
Microsoft.Dynamic.dll
Microsoft.Scripting.Core.dll
Microsoft.Scripting.Debugging.dll
Microsoft.Scripting.dll
Microsoft.Scripting.ExtensionAttribute.dll
p2pChat.dll
p2pChat.exe
p2pChat.py
p2pChat.xaml
stdlib.dll
Any ideas
cheers
Andrew
On Mon, Jul 12, 2010 at 11:13 AM, Dino Viehland <dinov at microsoft.com<mailto:dinov at microsoft.com>> wrote:
socket is actually a built-in in IronPython. So you really only need threading. But threading depends upon functools, and collections, and traceback. I'm not sure how far the transitive closure goes so let's just assume you'll need to compile the entire standard library. You can actually compile this into its own DLL using pyc. So you could do:
import System
import pyc
files = System.IO.Directory.GetFiles(r'C:\Program Files (x86)\IronPython 2.6\Lib')
files = [f for f in files if f.endswith('.py')]
import pyc
pyc.Main(files + ['/out:stdlib.dll'])
I'm just importing pyc directly here because for whatever reason it doesn't accept wildcards.
There's a bug in 2.6.1 which prevents this from working - it'll be fixed in 2.6.2. You could compile w/ 2.6.0 to get a working EXE or you could remove any std lib modules that fail to compile.
Now you can just do a clr.AddReference('stdlib.dll') in your script and the std lib will be available to you.
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 Andrew Evans
Sent: Monday, July 12, 2010 10:50 AM
To: Discussion of IronPython
Subject: [IronPython] compiling an executable with the standard library
I am having problems compiling an executable. From what research I have done, I need to include in my compilation the python standard modules that I am using. How ever I can not figure out how to do this.
Any advice would be appreciated here is the command I am using
ipy <path to pyc>\pyc.py /main:<path to app>\p2pChat.py /target:exe
these are the modules used in my script
import socket
from threading import *
Thank you in advance
_______________________________________________
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/20100713/0d1dfbc2/attachment.html>
More information about the Ironpython-users
mailing list