[Python.NET] accessing .net dlls from python
i.uemlianin at bangor.ac.uk
Wed Mar 29 11:02:50 CEST 2006
Roman Yakovenko wrote:
>On 3/28/06, ivan Uemlianin <i.uemlianin at bangor.ac.uk> wrote:
>>Is there a litle bit extra I need to do, or am I barking up the wrong
>>tree? I suppose I'm looking for something that will allow me to import
>>.net dlls as if they were python modules.
>I could be wrong, but it seems to me that before importing something from
>.net dlls, you should load them first.
>from CLR.System.Reflection import Assembly
>my_dll_name = Assembly.LoadWithPartialName( path to dll that does not
>include .dll extension )
>from CLR import TopNamespace
Hernan Martinez Foffani wrote:
Aha! Thanks! This has moved me on a lot, but I don't think I'm quite
1. Installing Python for .NET as a standalone, and using it in the
interactive session, all of the above, apart from 'from CLR import
TopNamespace' works. 'from CLR import TopNamespace' gets 'ImportError:
cannot import name TopNamespace'.
2. Installing Python for .NET as part of my existing Python
installation, and using it from within Pythonwin, none of the above
works: 'import CLR' raises a 'System.IO.FileNotFoundException' - I am
alerted by a 'Just-In-Time Debugging' pop-up window and Pythonwin
terminates 'in an unusual way'.
Should Python for .NET be used only from its own interactive prompt?
Why can't it import TopNamespace and can I do without it?
Thanks again for your help. This is going to be very handy: Windows and
.NET are alien environments to me (I work with linux and python).
More information about the PythonDotNet