Thanks to both Srivatsn and Michael, that worked! I have a few comments/questions:
1. How do I get a list of all imported DLLs? If I do "dir()" I don't see my test DLL. 2. Is the name of the assembly used as the namespace for all of the classes in this assembly? Thanks, > -----Original Message----- > From: Srivatsn Narayanan [mailto:[EMAIL PROTECTED] > Sent: Tuesday, August 26, 2008 2:15 PM > To: [EMAIL PROTECTED]; Discussion of IronPython > Subject: RE: [IronPython] Compiling into a DLL with pyc.py > and then calling the class > > You are missing an import after adding the reference. This > should work: > > clr.AddReference("test") > from test import test > t = test() > > There was also a bug with passing references with relative > path (fixed now). If it blows up for you, try passing in the > fully qualified assembly name. > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of hellosticky > Sent: Tuesday, August 26, 2008 11:07 AM > To: IronPython > Subject: [IronPython] Compiling into a DLL with pyc.py and > then calling the class > > 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! > > _______________________________________________ > 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
