[Python.NET] Importin­g .NET assembly with "." ­(dot) in the name

Mikhail Karmyshev kmike at hotbox.ru
Tue Apr 30 18:01:24 CEST 2013


Mark, thank you for your help.
Too bad that the original assembly which I am trying to use has namespace with "." in it:
namespace Accord.Imaging{
}

So in C#  "using Accord.Imaging'" works fine, but how to deal with it from Python?
Sure, I can write a "wrapper" application without dots in namespace, I tested it and it works.
But of course cleaner solution would be nice.


Втр 30 Апр 2013 22:21:42 +0700, Mark Tigges <mtigges at gmail.com> написал:
> import is namespace on the AddReference.
> 
> The import hooks look in the dll's that you've referenced, and search for namespaces as per the argument to Accord.  So, you shouldn't import the dll name.  If the assembly defines the namespace:
> 
> namespace AccordImaging
> {
> .......
> 
> Then, you should:
> 
> import AccordImaging
> 
> After you AddReference
> 
> On Mon, Apr 29, 2013 at 7:15 PM, Mikhail Karmyshev <kmike at hotbox.ru> wrote:
> Hello,
> Sorry for possibly dumb question, but is it possible to import an assembly with "." (dot) in the name ?
> Without dot, for example "SlimDX.dll" - AddReference works and import works too.
> But for "Accord.Imaging.dll" - AddReference is OK, but import fails:
> >>> import Accord.Imaging
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named Accord
> 
> Is there a workaround for this or am I doing something wrong?
> Any help appreciated.
> Mikhail
> _________________________________________________
> Python.NET mailing list - PythonDotNet at python.org
> http://mail.python.org/mailman/listinfo/pythondotnet

--


More information about the PythonDotNet mailing list