[Python.NET] Accessing Public Functions in Module
Brian Lloyd
brian.lloyd at revolutionhealth.com
Tue Dec 18 21:57:18 CET 2007
Most likely the vb.net compiler does some shenanigans and places this
(in the IL) in a place that might not be obvious (like a generated class).
If you use reflector on the assembly you can probably discover what its
real name is and try to import that from python.
-Brian
On 12/18/07 3:47 PM, "Feihong Hsu" <hsu.feihong at yahoo.com> wrote:
> Can you access these same functions in C#? Maybe what you have to do is write
> a wrapper library for your VB.NET library in C#, and have Python access the
> library through the the wrapper.
>
> - Feihong
>
>
> Kyle Stevens <kyle.stevens at thenortheastgroup.com> wrote:
>> We have an application that was developed in Visual Basic, and would
>> like to use Python for .NET to extend it. I've played around with it a
>> bit, and everything works fine if it is within a class in the .Net assembly.
>>
>> However, there are a number of components that exist as public functions
>> within a module. I cannot seem to access them from Python for .NET.
>>
>> My latest session is shown below, where I try to import and use the
>> function, "NonQuery" within the module, "SQL_Module" to no avail.
>>
>> Thanks for any help, and thanks for this wonderful piece of software. I
>> can't wait to start programming some things with this instead of Visual
>> Basic.
>>
>> Microsoft Windows XP [Version 5.1.2600]
>> (C) Copyright 1985-2001 Microsoft Corp.
>>
>> Z:\>\\buffalo02\share\IT\python\python\python.exe
>> Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
>> (Intel)] on
>> win32
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> >>> import Nepco4
>> Traceback (most recent call last):
>> File "", line 1, in
>> ImportError: No module named Nepco4
>>>>> >>> from NepcoV2 import Order
>>>>> >>> from NepcoV2 import NonQuery
>> Traceback (most recent call last):
>> File "", line 1, in
>> ImportError: cannot import name NonQuery
>>>>> >>> from NepcoV2 import SQL_Module.NonQuery
>> File "", line 1
>> from NepcoV2 import SQL_Module.NonQuery
>> ^
>> SyntaxError: invalid syntax
>>>>> >>> from NepcoV2.SQL_Module import NonQuery
>> Traceback (most recent call last):
>> File "", line 1, in
>> ImportError: No module named SQL_Module
>>>>> >>> import Nepco4.NepcoV2
>> Traceback (most recent call last):
>> File "", line 1, in
>> ImportError: No module named Nepco4.NepcoV2
>>>>> >>> from Nepco4 import NepcoV2
>> Traceback (most recent call last):
>> File "", line 1, in
>> ImportError: No module named Nepco4
>>>>> >>> from NepcoV2 import SQL_Module
>> Traceback (most recent call last):
>> File "", line 1, in
>> ImportError: cannot import name SQL_Module
>>>>> >>> from NepcoV2 import SQL_Module5
>> Traceback (most recent call last):
>> File "", line 1, in
>> ImportError: cannot import name SQL_Module5
>>>>> >>> from NepcoV2 import SQL_Modulf
>> Traceback (most recent call last):
>> File "", line 1, in
>> ImportError: cannot import name SQL_Modulf
>>>>> >>> from NepcoV2 import Shipping_Detail_Report
>>>>> >>> from NepcoV2 import *
>>>>> >>> NonQuery()
>> Traceback (most recent call last):
>> File "", line 1, in
>> NameError: name 'NonQuery' is not defined
>>>>> >>> NepcoV2.NonQuery()
>> Traceback (most recent call last):
>> File "", line 1, in
>> NameError: name 'NepcoV2' is not defined
>>>>> >>>
>> _________________________________________________
>> Python.NET mailing list - PythonDotNet at python.org
>> http://mail.python.org/mailman/listinfo/pythondotnet
>
>
>
>
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
> now.
> <http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HD
> tDypao8Wcj9tAcJ >
>
> _________________________________________________
> Python.NET mailing list - PythonDotNet at python.org
> http://mail.python.org/mailman/listinfo/pythondotnet
--------------------------
Brian Lloyd
brian.lloyd at revolutionhealth.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythondotnet/attachments/20071218/8c554b10/attachment.htm
More information about the PythonDotNet
mailing list