[IronPython] Exporting Python code as an assembly

Dino Viehland dinov at exchange.microsoft.com
Tue Feb 26 18:04:42 CET 2008


What's MakeModule.py?

Normally in v1.x if you do -X:SaveAssemblies or you use the pyc sample to compile a .py file you'll just be able to import it (like a .pyc file in Cpython).  AddReference is used for normal .NET assemblies.

But from the exception this looks like 2.0 - and I don't know how you're compiling in that case.  It could be that MakeModule.py is working against an older version of the hosting APIs and needs to be updated.  If you want more information about the exception I suggest running w/ -X:ExceptionDetail and we'll give you the full .NET stack trace.

But as of now IronPython 2.0 doesn't support compiling to an assembly it's self although we're currently looking into doing that.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Suma Talya
Sent: Tuesday, February 26, 2008 3:47 AM
To: users at lists.ironpython.com
Subject: Re: [IronPython] Exporting Python code as an assembly

Hi,

I have a py file by name IronPythonDLL.py containing
---------------------------------------------------------------
import clr
import System
import sys
from ClrWrapper import ClrAttribute, ClrAccepts, ClrReturns

class IronPythonClass:
    clr_namespace = 'IronPythonDLL'

    @ClrReturns(System.String)
    def IPyMethod(self):
        return "IronPython Method"
---------------------------------------------------------------
I have created IronPythonDLL.dll using MakeModule.py
Now through ironpython interpreter i tried creating an instance of the
above class and got an error,

 >>> import clr
 >>> clr.AddReference('IronPythonDLL.dll')
 >>> import IronPythonDLL
 >>> o=IronPythonDLL.IronPythonClass()
Traceback (most recent call last):
  File IronPythonDLL, line unknown, in .ctor
  File IronPythonDLL, line unknown, in InitClass
  File , line unknown, in ##26
TypeError: Value cannot be null.
Parameter name: scriptSource


Any help on this will be useful....

Thanks,
-Suma.

_______________________________________________
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