[IronPython] Compilation and ipy.exe

Pigneri, Rocco rpigneri at LavaStorm.com
Fri Feb 15 17:38:00 CET 2008


Michael,

Ironically, I actually saw that example yesterday, but I wasn't sure if
I should use it since FePy is another implementation of CPython.  I'll
give that another look today.  Do you know if it will work in IronPython
unchanged?

Thank you,

Rocco

-----Original Message-----
From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord
Sent: Friday, February 15, 2008 6:32 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Compilation and ipy.exe

Pigneri, Rocco wrote:
> Dear all,
>  
> Is there a way to make IronPython import module files with extensions 
> other than "py"?  For example, I would like to be able to name a file 
> "foo.ipy" to indicate that it's an IronPython file that is dependent 
> upon .NET.  I would then like to import it using "import foo" without 
> having to override __import__--that sounds like a lot of work just to 
> add an extension :-(.
>  
> The goal of this is to be able to easily differentiate files that are 
> pure-CPython but used by IronPython from those are cannot run without
it.

You can install import hooks to customize the import process. This is
just as much work (more) as overriding '__import__' but looks 'seamless'

in code that uses it.

Unfortunately import hooks don't seem to work very well in IronPython 1
but I think they work better in IronPython 2. There is an example of an
import hook in FePy for using C extensions from IronPython - it installs
a hook that lets you import '.pyd' files.

Michael
http://www.manning.com/foord

>  
> Thank you,
>  
> Rocco
> ----------------------------------------------------------------------
> --
>
> _______________________________________________
> 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