[Python.NET] ImportError: No module named Please help

Zane D. Purvis zane.purvis at gmail.com
Wed Dec 31 19:10:08 CET 2014

I've seen something at least similar to this when the DLL I'm trying to use references a type in another DLL. When I copied that other DLL to the same location, it worked fine.

In this situation, equivalent code in C# worked fine without the other DLL, but Python gave an error similar to what you are seeing. It does this even if the type I'm importing doesn't reference the type that can't be found: any reference in the assembly to an unfound type causes it. 

For me, an unrelated class in the assembly was using a JSON attribute, and I just needed to put the JSON DLL in the same directory. I could tell from looking at the commit logs of the .NET project what had changed, and was able to figure out what to do. I couldn't find a way through Python to tell what had failed. I wonder if Python.NET could be modified to either not require all types to be resolved even if they are not necessary or if it could at least identify the missing type.

> On Dec 31, 2014, at 12:44 PM, Murali CS <muraliright at gmail.com> wrote:
> Hi,
> We are using Python for .Net to create an API.
> C# Assembly is called by Python script to access API methods.
> import sys
> sys.path.append(r"C:\myfolderA\myfolderB")
> print sys.path
> import clr
> clr.FindAssembly(r"AA.BB.CC")
> clr.AddReference(r"AA.BB.CC")
> from AA.BB.CC.Api.DDInterface import DDClient
> On the above line I am getting following error
> Traceback (most recent call last):
>   File "C:\myfolderA\myfolderB\testAPI.py", line 7, in <module>
>     from AA.BB.CC.Api.DDInterface import DDClient
> ImportError: No module named AA.BB.CC.Api.DDInterface
> There is no other information available to exactly identify the issue.
> Dlls from same project built 15 days back works fine.
> This project may have gone through few changes in between.
> How to exactly identify this issue?
> Could this be a dependency issue? I tried code decompile to compare old dlls and new ones.
> Couldn't find anything unusual.
> I am using Python27
> Your help is deeply appreciated.
> Thanks,
> Murali
> _________________________________________________
> Python.NET mailing list - PythonDotNet at python.org
> https://mail.python.org/mailman/listinfo/pythondotnet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20141231/becbaeb7/attachment.html>

More information about the PythonDotNet mailing list