[IronPython] Compiling into a DLL with pyc.py and then calling the class
hellosticky
hellosticky at gmail.com
Tue Aug 26 20:21:50 CEST 2008
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:srivatsn at microsoft.com]
> Sent: Tuesday, August 26, 2008 2:15 PM
> To: hellosticky at gmail.com; 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: users-bounces at lists.ironpython.com
> [mailto:users-bounces at lists.ironpython.com] 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
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
More information about the Ironpython-users
mailing list