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
> [email protected]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>   

_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to