[Python.NET] exposing modules

Srivatsa, Radhika Radhika.Srivatsa at ngc.com
Tue Jun 13 22:47:56 CEST 2006


I am trying to achieve the first step still - of emedding the python
interpreter within my .NET application and am kind of stuck there. 

Here's what I did:

1) Added "Python.Runtime.dll" to the build (of .NET project).

2) Added the following line in the constructor:

This gives me the following errors:
error C2065: 'PythonEngine' : undeclared identifier
error C2228: left of '.Initialize' must have class/struct/union type
        type is ''unknown-type''

What other step have I missed ?



Radhika Srivatsa
UMS Software Development
Voice: (858)618-2235

>-----Original Message-----
>From: pythondotnet-bounces at python.org 
>[mailto:pythondotnet-bounces at python.org] On Behalf Of Haran Shivanan
>Sent: Thursday, June 08, 2006 8:27 PM
>To: pythondotnet at python.org
>Subject: [Python.NET] exposing modules
>I'm trying to embed the python interpreter in my .NET-based program.
>The basic stuff is working fine.
>But now, I want to expose some of my program's internal data 
>to the scripts.
>(ie, not just functions that live in an assembly, but access 
>to my live program's state) For example, if I have a WinForms 
>application, I want to be able to access a textbox's current 
>text from python.
>Ideally, I should be able to do something like this from a script:
>import MyApp
>s = MyApp.GetText()
>Is there any way to do this in Python.NET?
>And if not, can someone provide me with some pointers on how 
>to go about adding the functionality to the Python.NET code?
>(I believe we have to use issue a call to Py_InitModule or something,
>Python.NET mailing list - PythonDotNet at python.org 

More information about the PythonDotNet mailing list