[IronPython] IP Tutorial Error

Martin Maly Martin.Maly at microsoft.com
Wed Jan 4 08:40:38 PST 2006


You are correct. Actually, you are hitting the same problem that Steven Drucker reported yesterday. If the class is top-level (in the global namespace), IronPython won't import it. The simple workaround is to enclose the class in the namespace and then import

from namespace import class

I hope this helps. This is a bug that we introduced in Beta 1 and will fix it in the next release.

Martin


________________________________

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Catalin Lungu
Sent: Tuesday, January 03, 2006 11:22 PM
To: Discussion of IronPython
Subject: Re: [IronPython] IP Tutorial Error


Ok, you have right. In clr.Reference I found "csextend", but when I import "import Simple" the console return:
Trackback (most recent call last):
   File, line 0, in imput ##1
Import Error: No module named Simple
I am sure that the name of the C class is Simple.

Thanks,
Catalin

----- Original Message -----
From: Haibo Luo
To: Discussion of IronPython
Sent: Tuesday, January 03, 2006 7:26 PM
Subject: Re: [IronPython] IP Tutorial Error


clr.AddReferenceToFile returns void, so "print a gets None" is expected.
clr.References could be what you are looking for.

________________________________

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Catalin Lungu
Sent: Tuesday, January 03, 2006 7:58 AM
To: Discussion of IronPython
Subject: [IronPython] IP Tutorial Error

Hello,
I compiled the folowing class with "csc" to csextend.dll

using System;
using System.Collections;

public class Simple
{
 private int data;
 public Simple(int data)
 {
  this.data = data;
 }
 public override string ToString()
 {
  return String.Format("Simple<{0}>", data);
 }
}

When I try to use the "csextend.dll" module the return variable is null.
>>import clr
>>a=clr.AddReferenceToFile("csextend.dll")
>>print a
None
By the way I have tried with another .cs module and I receive the same result.
I use VS2005 Professional and IronPython 1.0 - Beta1

Any ideea?
Catalin

________________________________

_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/users-ironpython.com/attachments/20060104/db11f472/attachment.htm


More information about the users mailing list