Re: [Python.NET] Problem with System.ArgumentException in call to method from dll

2013-01-24 Thread Barton
Two things spring instantly to mind (thanks for the reminder) 1) A patch has been submitted that tries very cleverly to allow out params to be omitted. This sounds like it's worth pursuing. 2) iPy's Reference type is something that I looked into implementing which would (or could) allow the wrap

Re: [Python.NET] Problem with System.ArgumentException in call to method from dll

2013-01-24 Thread Barton
Because the Python.Runtime library also provides means of embedding python in a .NET program using pinvoke to call the native python dll, it is, by nature, "unsafe". On 01/22/2013 05:00 PM, b...@fie.us wrote: Just to clarify: neither version of th

Re: [Python.NET] Problem with System.ArgumentException in call to method from dll

2013-01-23 Thread Daniel Krause
Krause > *Sent:* Tuesday, January 22, 2013 10:08 PM > > *To:* pythondotnet@python.org > *Subject:* Re: [Python.NET] Problem with System.ArgumentException in call > to method from dll > > ** ** > > @Brett > > ** ** > > When I try > > ** ** >

Re: [Python.NET] Problem with System.ArgumentException in call to method from dll

2013-01-23 Thread Jeffrey Bush
As previously said you have to probably do something like: from System.Windows.Media.Imaging import BitmapSource bitmapsrc = None cam = xiCam() cam.OpenDevice(0) cam.SetParam(PRM.BUFFER_**POLICY, BUFF_POLICY.SAFE) cam.SetParam(PRM.IMAGE_DATA_**FORMAT, IMG_FORMAT.MONO8) cam.StartAcquisition() time

Re: [Python.NET] Problem with System.ArgumentException in call to method from dll

2013-01-23 Thread Daniel Krause
I tried this approach: class PyBitmapSource(BitmapSource): pass bitmapsrc = PyBitmapSource() print bitmapsrc The console output does not really change: TypeError: cannot instantiate abstract class 2013/1/23 Barton > The Python.Runtime is a bit tricky when it comes to out parameters: > In

Re: [Python.NET] Problem with System.ArgumentException in call to method from dll

2013-01-23 Thread Tribble, Brett
rause Sent: Tuesday, January 22, 2013 10:08 PM To: pythondotnet@python.org Subject: Re: [Python.NET] Problem with System.ArgumentException in call to method from dll @Brett When I try bitmapsrc = BitmapSource() I get the following error: Traceback (most recent call last): File "C:

Re: [Python.NET] Problem with System.ArgumentException in call to method from dll

2013-01-23 Thread b...@fie.us
Out of curiosity Barton, could you pass "None" rather than constructing instances? Or does it truly need the argument to have a type in order to disambiguate overloaded methods? Also, it is my understanding that in iPy, out parameters are often omitted from the method's arguments. But in Pyth

Re: [Python.NET] Problem with System.ArgumentException in call to method from dll

2013-01-23 Thread Daniel Krause
@Brett When I try bitmapsrc = BitmapSource() I get the following error: Traceback (most recent call last): File "C:\Users\mdk\workspace\\camera\testbitmap.py", line 8, in bitmapsrc = BitmapSource() TypeError: cannot instantiate abstract class I will have a look at System.Reflection, tha

Re: [Python.NET] Problem with System.ArgumentException in call to method from dll

2013-01-23 Thread Barton
The Python.Runtime is a bit tricky when it comes to out parameters: In C# DateTime.TryParse(String, out DateTime) becomes >>> d = DateTime(0)# just a dummy to call the method on >>> d2 = DateTime(0) # another dummy to satisfy the out parameter (could be the same instance, d) # d3 is were th

Re: [Python.NET] Problem with System.ArgumentException in call to method from dll

2013-01-22 Thread b...@fie.us
Just to clarify: neither version of the methods you are calling are marked "unsafe" in the proper c# .net manner are they? I would not be surprised to find PythonNet not providing access to "unsafe" methods. I would need to take a trip through the source to verify. On Jan 22, 2013, at 4:10 P

Re: [Python.NET] Problem with System.ArgumentException in call to method from dll

2013-01-22 Thread Tribble, Brett
lem with System.ArgumentException in call to method from dll That is right, I want to get the value of the output parameter. The following variant looks much more logical to me, but than I get another error: bitmapsrc = cam.GetImage(timeout) TypeError: No method matches given arguments So it seems that I have to

Re: [Python.NET] Problem with System.ArgumentException in call to method from dll

2013-01-22 Thread Daniel Krause
That is right, I want to get the value of the output parameter. The following variant looks much more logical to me, but than I get another error: bitmapsrc = cam.GetImage(timeout) TypeError: No method matches given arguments So it seems that I have to pass the "out"-parameter to the method as we

Re: [Python.NET] Problem with System.ArgumentException in call to method from dll

2013-01-22 Thread b...@fie.us
You are setting the bitmapsrc variable to be equal to the class BitmapSource. I assume you mean to get the value of an output parameter, rather than pass a class object into the method. Though I do not speak german. But I think that's it. On Jan 22, 2013, at 2:58 PM, Daniel Krause wrote: >