Re: [Python.NET] exposing modules
Hi Haran It sounds almost as though the Python.Runtime.dll, though added to your project, is not listed as a reference for the code you're compiling. In Visual Studio 2005 (the only one of which I have experience) you'd click References and add a new one (navigating to the dll). If using nant, the <csc> element needs a child element <references> containing an <include name="Python.Runtime.dll"/>. Once done, and assuming you have not omitted the using statement in your code (and not mis-spelled the package name) I would hope your code would compile. I appologise if I'm merely stating the obvious here - your email didn't have a huge amount to go on so I'm just running down the list of things I personally would check first! If you still have trouble, let us know how you are building your code etc. and I'll try and help further :) Kind regards Matthew -----Original Message----- From: pythondotnet-bounces@python.org [mailto:pythondotnet-bounces@python.org] On Behalf Of Srivatsa, Radhika Sent: 13 June 2006 21:48 To: Haran Shivanan; pythondotnet@python.org Subject: Re: [Python.NET] exposing modules Hi, 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: PythonEngine.Initialize(); 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 ? Thanks --Radhika Radhika Srivatsa UMS Software Development Voice: (858)618-2235
-----Original Message----- From: pythondotnet-bounces@python.org [mailto:pythondotnet-bounces@python.org] On Behalf Of Haran Shivanan Sent: Thursday, June 08, 2006 8:27 PM To: pythondotnet@python.org Subject: [Python.NET] exposing modules
Hi,
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, right?)
Thanks, Haran _________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet
_________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet
Hi , All (Minor point, but I'm not the author of that mail. I think Srivatsa asked the question) Anyway, I think you need to add a "using Python.Runtime" clause to the top of the file before this will work. Thanks, Haran Matthew Pontefract wrote:
Hi Haran
It sounds almost as though the Python.Runtime.dll, though added to your project, is not listed as a reference for the code you're compiling. In Visual Studio 2005 (the only one of which I have experience) you'd click References and add a new one (navigating to the dll). If using nant, the <csc> element needs a child element <references> containing an <include name="Python.Runtime.dll"/>.
Once done, and assuming you have not omitted the using statement in your code (and not mis-spelled the package name) I would hope your code would compile.
I appologise if I'm merely stating the obvious here - your email didn't have a huge amount to go on so I'm just running down the list of things I personally would check first! If you still have trouble, let us know how you are building your code etc. and I'll try and help further :)
Kind regards Matthew
-----Original Message----- From: pythondotnet-bounces@python.org [mailto:pythondotnet-bounces@python.org] On Behalf Of Srivatsa, Radhika Sent: 13 June 2006 21:48 To: Haran Shivanan; pythondotnet@python.org Subject: Re: [Python.NET] exposing modules
Hi,
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: PythonEngine.Initialize();
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 ?
Thanks
--Radhika
Radhika Srivatsa UMS Software Development Voice: (858)618-2235
-----Original Message----- From: pythondotnet-bounces@python.org [mailto:pythondotnet-bounces@python.org] On Behalf Of Haran Shivanan Sent: Thursday, June 08, 2006 8:27 PM To: pythondotnet@python.org Subject: [Python.NET] exposing modules
Hi,
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, right?)
Thanks, Haran _________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet
_________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet
Haran Shivanan wrote:
Hi , All
(Minor point, but I'm not the author of that mail. I think Srivatsa asked the question) Anyway, I think you need to add a "using Python.Runtime" clause to the top of the file before this will work.
Nevermind. The question was already answered. Sorry for the spam
participants (2)
-
Haran Shivanan
-
Matthew Pontefract