[IronPython] Compiling into a DLL with pyc.py and then calling the class

hellosticky hellosticky at gmail.com
Tue Aug 26 20:07:23 CEST 2008


Hi, I'm new to IronPython. I have the following test.py:

from System import *
from System.Collections.Generic import *
from System.Text import *
from PublicDomain import *

class test:
	def foo(self):
		return GlobalConstants.EarthEquatorialRadiusInKilometers

PublicDomain is a package from here: http://www.codeplex.com/PublicDomain

I compile this python file into a DLL with:

ipy.exe pyc.py /out:test /target:dll /r:..\publicdomain\PublicDomain.dll test.py

Everything looks good in ildasm. Then I load up ipy.exe:

>ipy
IronPython 2.0 Beta (2.0.0.4000) on .NET 2.0.50727.1433
Type "help", "copyright", "credits" or "license" for more information.
>>> import clr
>>> clr.AddReference("test")
>>> t = test()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'test' is not defined

Any ideas what I'm doing wrong?

Thanks!




More information about the Ironpython-users mailing list