[IronPython] can't import namespace from assembly

Carolyn Johnston (MSNAR) carolj at microsoft.com
Sat Dec 6 00:11:06 CET 2008


Thank you, that was the problem.

:) Carolyn

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord
Sent: Friday, December 05, 2008 3:05 PM
To: Discussion of IronPython
Subject: Re: [IronPython] can't import namespace from assembly

In the past I've had this error when I've forgotten to make the class
public. Possibly not the problem, but you never know. :-)

Michael Foord

Carolyn Johnston (MSNAR) wrote:
>
> I have a dll that I've built in VS2008, C# (and I even strongly named
> it): Normalizer.dll. It contains a namespace (StringUtilities) which
> contains a single class (MaxNormalizer).
>
> I can't import the StringUtilities namespace:
>
> >>> ass = Assembly.Load("Normalizer.dll")
>
> >>> ass
>
> <Assembly Normalizer, Version=1.0.0.0, Culture=neutral,
> PublicKeyToken=0707cddf2bb66849>
>
> >>> clr.AddReference(ass)
>
> >>> import StringUtilities
>
> Traceback (most recent call last):
>
> File , line 0, in <stdin>##229
>
> File , line 0, in __import__##7
>
> ImportError: No module named StringUtilities
>
> However you can see that "ass" does contain the StringUtilities
> namespace (I've included the listNamespaces code at bottom of this email):
>
> >>> ass.GetTypes()
>
> System.Type[](<System.RuntimeType object at 0x000000000000002E
> [StringUtilities.MaxNormalizer]>)
>
> I also found a help page from Dino here
> (http://lists.ironpython.com/pipermail/users-ironpython.com/2007-April/004792.html)
> that implied StringUtilities ought to be an attribute of the assembly
> itself, so I tried that too:
>
> >>> ass.StringUtilities
>
> Traceback (most recent call last):
>
> File , line 0, in <stdin>##231
>
> AttributeError: assembly Normalizer has no type StringUtilities
>
> And then I made one last desperate shot at it:
>
> >>> from Normalizer import StringUtilities
>
> Traceback (most recent call last):
>
> File , line 0, in <stdin>##232
>
> File , line 0, in __import__##7
>
> ImportError: No module named Normalizer
>
> >>>
>
> Any clues as to why this namespace can't be imported? I'm stumped.
>
> Thanks,
>
> Carolyn
>
> *---
> Carolyn Johnston (carolj)*
> Lead Researcher, Local Search, Virtual Earth
> Bldg 116/2276 | MIcrosoft Corporation
> 425-706-2153**
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>


--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog


_______________________________________________
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