1

I'm having a problem calling a method from a .NET dll linked to the eBUS SDK. The end goal of the code is to communicated to a GigE connected camera using python.

In C#, the method is: public void SetStreamDestination( string aIPAddress, ushort aDataPort ) , and is part of a class called PvDeviceGEV.

In Python, I'm using pythonnet to import the dll. I'm then using this code:

from PvDotNet import PvDeviceGEV
from PvDotNet import PvStreamGEV

DeviceGEV = PvDeviceGEV()
Stream = PvStreamGEV()

LocalIP = Stream.LocalIPAddress
LocalPort = Stream.LocalPort
DeviceGEV.SetStreamDestination(LocalIP, LocalPort)

This results in an error:

TypeError: No method matches given arguments for SetStreamDestination: (<class 'str'>, <class 'int>)

Seeing as the types of IPAddress and aDataPort should be string and UInt16 respectively, I don't understand this error. I've been able to call other methods from this class. This is my first time trying to import functions from another language into Python. Any help understanding or correcting this error would be appreciated.

Chris-G
  • 23
  • 4
  • I just did a quick test, and from Python I seem to be able to call a method, defined in C# as `public void Test(string str, System.UInt16 u16)`. Can you share the .NET dll somewhere so I could take a look? – LOST Sep 17 '20 at 19:22
  • The DLL can be found in common files after downloading the eBUS player. https://www.pleora.com/products/ebus-software/ebus-player/ Licensing wise I'm not sure I can share the DLL outside of that – Chris-G Sep 17 '20 at 20:15

1 Answers1

0

I solved this by changing SetStreamDestination(LocalIP, LocalPort) to SetStreamDestination(LocalIP, UInt16(LocalPort))

Chris-G
  • 23
  • 4