[IronPython] Accessing CPython from compiled assemblies

Harry Pierson Harry.Pierson at microsoft.com
Thu Sep 17 19:45:54 CEST 2009


FYI, I covered how to compile CPython python packages into a DLL for inclusion in my Pygments for WLWriter project. Relevant post is at http://devhawk.net/2009/08/10/Compiling+Python+Packages+Into+Assemblies.aspx

Harry

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord
Sent: Thursday, September 17, 2009 4:28 AM
To: davidescobar at ieee.org; Discussion of IronPython
Subject: Re: [IronPython] Accessing CPython from compiled assemblies

David Escobar wrote:
> I'm using IronPython 2.6 B2 and accessing the CPython 2.6 libraries in 
> the standard way.
>
> import sys
> sys.path.append(r"c:\python26\lib")
>
> When I compile to an .exe, is there a way to link in the CPython 
> libraries I'm using? Otherwise I get an ImportError when I run the 
> application on a machine that does not have CPython 2.6 installed. Thanks.

Are you compiling to exe with the Pyc compiler? If so you will also need to compile the standard library modules that you use (*instead* of adding them to the path).

Another technique is to have your own version of the standard library (or just the parts you use) in a directory in the same folder as your exe - and add *this* directory to the path instead.

Michael

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


--
http://www.ironpythoninaction.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