Discussion:
[Python.NET] C# path for 3rd-party libraries?
Jason Sachs
2013-07-23 20:45:52 UTC
Permalink
I got the pythonnet libraries installed and working with my Python
installation, and I can do

import clr
import System

without errors, but when I go to import a 3rd-party .NET library I have
import clr
import System
import OpenLayers.Base
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named OpenLayers.Base
How do I tell pythonnet where .NET libraries are? I have essentially no
background with .NET, I'm familiar with Java so there are a lot of
parallels but I don't understand how to make these libraries visible to
Python.
Jason Sachs
2013-07-23 21:05:36 UTC
Permalink
Never mind, I figured it out, you just have to make sure the .dll files are
in the PYTHONPATH.
Post by Jason Sachs
I got the pythonnet libraries installed and working with my Python
installation, and I can do
import clr
import System
without errors, but when I go to import a 3rd-party .NET library I have
Post by Jason Sachs
import clr
import System
import OpenLayers.Base
File "<stdin>", line 1, in <module>
ImportError: No module named OpenLayers.Base
How do I tell pythonnet where .NET libraries are? I have essentially no
background with .NET, I'm familiar with Java so there are a lot of
parallels but I don't understand how to make these libraries visible to
Python.
Tribble, Brett
2013-07-23 22:07:09 UTC
Permalink
I think you can register them in the GAC as well, but this is a pain in the butt to maintain.

http://en.wikipedia.org/wiki/Global_Assembly_Cache

From: PythonDotNet [mailto:pythondotnet-bounces+btribble=ea.com-+ZN9ApsXKcFQFI55V6+***@public.gmane.orgg] On Behalf Of Jason Sachs
Sent: Tuesday, July 23, 2013 2:06 PM
To: pythondotnet-+ZN9ApsXKcEdnm+***@public.gmane.org
Subject: Re: [Python.NET] C# path for 3rd-party libraries?

Never mind, I figured it out, you just have to make sure the .dll files are in the PYTHONPATH.

On Tue, Jul 23, 2013 at 1:45 PM, Jason Sachs <jmsachs-***@public.gmane.org<mailto:jmsachs-***@public.gmane.org>> wrote:
I got the pythonnet libraries installed and working with my Python installation, and I can do

import clr
import System
Post by Jason Sachs
import clr
import System
import OpenLayers.Base
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named OpenLayers.Base
How do I tell pythonnet where .NET libraries are? I have essentially no background with .NET, I'm familiar with Java so there are a lot of parallels but I don't understand how to make these libraries visible to Python.
Loading...