Hi All,
I am trying to interface with C# dlls from python. I am using Python.net
2.0 version. Please find the problem description:
python:
clr.AddReference("X.dll")
import Master.Child as ChildClass
ChildClass.Currclass(structVal, enumval) ---Step 1
ChildClass.Currclass(2,3) ---Step 2
C# code (which gives X.dll)
namespace Master.Child
{
enum enumval
{
-,
--,
--,
}
class Currclass{
Currclass(Stream X, enumval enum) .-.-Constructor 1
{
Console.WriteLine("Step1");
}
Currclass(int x, int y)
.-.-Constructor 2
{
Console.WriteLine("Step2");}
}}
When i try to create an instance using the custom types (ie Setp1), the
C# constructor : Constructor2 is executed and while executing the Step2
also the Constructor 2 is called.
I am not sure, why Constructor 1 is not called. Is it because it uses
the custom arguments types ?
Any inputs to call Constructor1 is welcome.
********************
Legal Notice:
The information in this electronic transmission may contain confidential or
legally privileged information and is intended solely for the individual(s)
named above. If you are not an intended recipient or an authorized agent,
you are hereby notified that reading, distributing, or otherwise
disseminating, copying or taking any action based on the contents of this
transmission is strictly prohibited. Any unauthorized interception of this
transmission is illegal under law. If you have received this transmission in
error, please notify the sender by telephone [at the number indicated above/
on +41 58 928 0101] as soon as possible and then destroy all copies of this
transmission.
********************
Hello all,
I have two questions:
1) are there examples of embedding python in vb .NET
2)
I'm trying to figure out how I can use the Python.Runtime.dll form VB.NET. I added it as a reference and imported using:
Imports Python.Runtime
Module Module1
Sub Main()
PythonEngine.Initialize()
Dim a As String
PythonEngine.RunString("5+7" & vbCrLf)
' how can I get the result of that easy string?
End Sub
End Module
Many Thx,
Johan
_________________________________________________________________
Nieuwe lente...Een nieuw online leven...Gratis dankzij Windows Live
http://get.live.com
Hi,
i am trying to pass a dictinoary from python to C#. i am using python25
with python.NET 2.0 alpha 2 files(python.Runtime.dll, clr.pyd). When i
try to initiate function , i get an error saying
"TypeError: No method matches given arguments". Could someone confirm
me, if this is supported?
Pythonfile:
main.py:
params = {"one": "1","two":"2"}
ret = Hello_Dict(params)
C# file:
int Hello_Dict(Dictionary<String,String> params_=
{
--;
--;
return 1;
}
********************
Legal Notice:
The information in this electronic transmission may contain confidential or
legally privileged information and is intended solely for the individual(s)
named above. If you are not an intended recipient or an authorized agent,
you are hereby notified that reading, distributing, or otherwise
disseminating, copying or taking any action based on the contents of this
transmission is strictly prohibited. Any unauthorized interception of this
transmission is illegal under law. If you have received this transmission in
error, please notify the sender by telephone [at the number indicated above/
on +41 58 928 0101] as soon as possible and then destroy all copies of this
transmission.
********************
Hi,
I'm trying to access a custom .NET Assembly with Python .NET, but can't
get it to recognise the Assembly name space. IronPython works fine in
the code below. Any clues? I'm using the Python .NET build from here:
http://sourceforge.net/project/showfiles.php?group_id=162464
-------------------------
import sys
GLOBAL_IRONPython = "Iron" in sys.version
# Need full path (or could add the path to sys.path)
FDO_DLL_PATH = "c:\\program files\\sil\\fieldworks\\FDO.dll"
import clr
if GLOBAL_IRONPython:
print "IRON Python Startup"
clr.AddReferenceToFileAndPath(FDO_DLL_PATH)
else:
# Python .NET
print "Python .NET Startup"
from System.Reflection import Assembly
fdo = Assembly.LoadFile(FDO_DLL_PATH)
# This is failing in Python .NET -- "No module named
SIL.FieldWorks.FDO"!
from SIL.FieldWorks.FDO import FdoCache
db = FdoCache.Create("DB-name")
print db.ServerName, db.DatabaseName
-------------------------
I've also tried clr.AddReference("SIL.FieldWorks.FDO"), but that reports
"Unable to find assembly 'SIL.Fieldworks.FDO'."
Thanks,
Craig.