Discussion:
[Python.NET] C# components for script
Singh, Mandeep
2008-11-11 03:56:12 UTC
Permalink
Hi,
I have written c# components to be used by Python. I note that
those components need to be placed in the Pythonnet installation
directory because its like private assemblies being loaded. Is there a
way I can place them in separate location?

Thanks & regards,
Mandeep Singh
Equity IT
Credit Suisse
Tel: (+65) 6212 8755
==============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer:

http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================
Sandro Hardy
2008-11-11 11:37:49 UTC
Permalink
Hi,

you can place them in your AppDir, i did so. Maybe somewhere else,
perhaps in your dll path, but I dont know. Try it.
Post by Singh, Mandeep
Hi,
I have written c# components to be used by Python. I note that
those components need to be placed in the Pythonnet installation
directory because its like private assemblies being loaded. Is there a
way I can place them in separate location?
Thanks & regards,
/Mandeep Singh**/******
*Equity IT*
*Credit Suisse*
Tel: (+65) 6212 8755
==============================================================================
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================
------------------------------------------------------------------------
_________________________________________________
http://mail.python.org/mailman/listinfo/pythondotnet
_________________________________________________
Python.NET mailing list - PythonDotNet-+ZN9ApsXKcEdnm+***@public.gmane.org
http://mail.python.org/mailman/listinfo/pythondotnet
Sandro Hardy
2008-11-11 12:09:35 UTC
Permalink
Hi,

sorry, my Fault. My dll ist also in my Pythonnet dir.
Post by Sandro Hardy
Hi,
you can place them in your AppDir, i did so. Maybe somewhere else,
perhaps in your dll path, but I dont know. Try it.
Post by Singh, Mandeep
Hi,
I have written c# components to be used by Python. I note that
those components need to be placed in the Pythonnet installation
directory because its like private assemblies being loaded. Is there a
way I can place them in separate location?
Thanks & regards,
/Mandeep Singh**/******
*Equity IT*
*Credit Suisse*
Tel: (+65) 6212 8755
==============================================================================
Please access the attached hyperlink for an important electronic
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================
------------------------------------------------------------------------
_________________________________________________
http://mail.python.org/mailman/listinfo/pythondotnet
_________________________________________________
http://mail.python.org/mailman/listinfo/pythondotnet
_________________________________________________
Python.NET mailing list - PythonDotNet-+ZN9ApsXKcEdnm+***@public.gmane.org
http://mail.python.org/mailman/listinfo/pythondotnet
Sandro Hardy
2008-11-11 14:28:59 UTC
Permalink
Hi,

it works like I wrote in my first mail. Tried it now. So put your dll in
your App-Dir.
Post by Sandro Hardy
Hi,
sorry, my Fault. My dll ist also in my Pythonnet dir.
Post by Sandro Hardy
Hi,
you can place them in your AppDir, i did so. Maybe somewhere else,
perhaps in your dll path, but I dont know. Try it.
Post by Singh, Mandeep
Hi,
I have written c# components to be used by Python. I note
that those components need to be placed in the Pythonnet installation
directory because its like private assemblies being loaded. Is there
a way I can place them in separate location?
Thanks & regards,
/Mandeep Singh**/******
*Equity IT*
*Credit Suisse*
Tel: (+65) 6212 8755
==============================================================================
Please access the attached hyperlink for an important electronic
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================
------------------------------------------------------------------------
_________________________________________________
http://mail.python.org/mailman/listinfo/pythondotnet
_________________________________________________
http://mail.python.org/mailman/listinfo/pythondotnet
_________________________________________________
http://mail.python.org/mailman/listinfo/pythondotnet
_________________________________________________
Python.NET mailing list - PythonDotNet-+ZN9ApsXKcEdnm+***@public.gmane.org
http://mail.python.org/mailman/listinfo/pythondotnet
Maksim Kozyarchuk
2008-11-11 13:20:27 UTC
Permalink
Mandeep,
You have 2 options.
* You can use LoadFrom to load the dll from a particular location
import clr
import System
System.Reflection.Assembly.LoadFrom("your.DLL")
* If your DLL and Namespace have the same name python.net should be able
to find the dll in the PYTHONPATH

Maksim
Post by Singh, Mandeep
Hi,
I have written c# components to be used by Python. I note that
those components need to be placed in the Pythonnet installation
directory because its like private assemblies being loaded. Is there a
way I can place them in separate location?
Thanks & regards,
/Mandeep Singh**/******
*Equity IT*
*Credit Suisse*
Tel: (+65) 6212 8755
==============================================================================
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================
------------------------------------------------------------------------
Tribble, Brett
2008-11-11 19:40:18 UTC
Permalink
Yes, they can be anywhere, you just need to write some code to add them to the SYSTEM path for the current running code. Optionally, you can also tell .NET where to look for the assembly's config file.

import sys
import clr
import System

loadDir = 'C:/myAssemblyPath/'
assemblyName = 'myDLL.dll'
configfileName = 'myDLL.ini'

# add to system path
if not loadDir in sys.path:
sys.path.insert(0, loadDir)

# tell .NET where to look for the applications config file
System.AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", (loadDir + configfileName))

# load it up
clr.AddReference(assemblyName)


Cheers,

Brett


From: pythondotnet-bounces+btribble=maxis.com-+ZN9ApsXKcEdnm+***@public.gmane.org [mailto:pythondotnet-bounces+btribble=maxis.com-+ZN9ApsXKcEdnm+***@public.gmane.org] On Behalf Of Singh, Mandeep
Sent: Monday, November 10, 2008 7:56 PM
To: pythondotnet-+ZN9ApsXKcEdnm+***@public.gmane.org
Subject: [Python.NET] C# components for script


Hi,
I have written c# components to be used by Python. I note that those components need to be placed in the Pythonnet installation directory because its like private assemblies being loaded. Is there a way I can place them in separate location?

Thanks & regards,
Mandeep Singh
Equity IT
Credit Suisse
Tel: (+65) 6212 8755


==============================================================================

Please access the attached hyperlink for an important electronic communications disclaimer:



http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html

==============================================================================
Loading...