[Ironpython-users] abstract class conversion?
mcolonno at stanford.edu
Thu Dec 1 19:14:02 CET 2011
I'm trying to port some VB.NET code to IronPython; the goal is
to access third-party .NET functionality through Python. I've managed to
connect to the relevant Interop .dll files and expose the API but I'm having
trouble reproducing the VB.NET functionality from Python (most likely due to
my lack of familiarity with .NET itself).
In VB.NET, this works just fine:
Dim A As Type
Dim Name As String
Dim Option As Boolean
Dim Err As Integer
Dim value As Object
value = A.function(Name, Option, Err)
In IronPython I am trying (pseudo-code):
from API.Interop.whatever import Type
A = Type()
value = A.function("Name", True, err)
Two issues / questions:
1. The IronPython code above produces: TypeError: Cannot create
instances of Type because it is abstract. Why is an abstract Python class
being created and do I have any control over this?
2. Changing the code to access the functions of Type directly (e.g.
Type.function()) results in a "self" argument being expressed as the first
argument in the function. i.e. the syntax expected is now
Type.function(self, string, boolean, int). I'm familiar with "self" only in
the context of defining class functions and not outside of a class
My guess is that I'm not understanding / using the .NET <---> Python
conversion correctly. Any advice or guidance would be greatly appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironpython-users