<div dir="ltr">I had been thinking about this, and while I haven't messed with Python on .NET, I have messed with C# some, as well as other Python on top of another language type arrangements.<div><br></div><div>There must be either one of two things you can do, but the details of which you may be on your own to investigate (sorry):</div><div><br></div><div>1. The Python.NET, being dynamically typed, must have some sort of functions to support the static (and more specific) types of the .NET system. This may be something that allows you to specifically create a C# compatible array of unsigned shorts like that second parameter of the function requires. I would imagine a study of the documentation for Python.NET may well reveal some kind of capability like this as a language support library or something similar. I know with say, Jython, it is called Java Interop, same with Clojure on the JVM.</div><div><br></div><div>2. You could approach this the other way, and write some C# to wrap this function in a function that does work with Python the way you want or however you can get it to work, then in this new C# function, coerce the types passed in to be an array of unsigned shorts, and pass that to the original function.</div><div><br></div><div>Best of luck, and let us know if you find anything interesting.</div><div><br></div><div>Thomas</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 21, 2015 at 10:10 PM, Mark Erbaugh <span dir="ltr"><<a href="mailto:mark@microenh.com" target="_blank">mark@microenh.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Greetings,<br>
<br>
I am struggling with a hobby project using PythonDotNet.  I have an API for an external device written in C# and .NET.  I have the C# code. Rather than using IronPython, I am trying to use PythonDotNet with CPython 2.7.9. The C# code was not written with any special consideration of Python.<br>
<br>
The API implements callback functions. I have been able to write several of the callback functions in Python and they work. But, now I've come across something that I can't figure out, and perhaps it's not supported by PythonDotNet. There is a callback routine that passes a C# array of shorts.  the C# function signature is<br>
<br>
        public delegate void DataReadyEventHandler(<u></u>Panadapter pan, ushort[] data);<br>
<br>
No matter how I try to code my Python function, I am getting a runtime exception from the PythonRuntime part of PythonDotNet.<br>
<br>
Is passing this array possible?<br>
<br>
Thanks,<br>
Mark<br>
______________________________<u></u>_________________<br>
CentralOH mailing list<br>
<a href="mailto:CentralOH@python.org" target="_blank">CentralOH@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/centraloh" target="_blank">https://mail.python.org/<u></u>mailman/listinfo/centraloh</a><br>
</blockquote></div><br></div>