From barton at BCDesignsWell.com Tue Mar 1 10:51:08 2011 From: barton at BCDesignsWell.com (Barton) Date: Tue, 01 Mar 2011 01:51:08 -0800 Subject: [Python.NET] Pythonnet for Python2.7 binary distribution? In-Reply-To: References: Message-ID: <4D6CC18C.1020907@BCDesignsWell.com> Yes - I'll do the build and upload it when I get a little time this week. -barton On 2/28/2011 2:59 PM, Olof Bjarnason wrote: > Hi Python.NET (is that the correct spelling..?) community! > > I learned of Python.NET today. I love the idea of being able to use > the .NET assemblies/types directly from CPython. I've tried IronPython > before, but it just does not feel Python enough for me :) > > But I failed to play with Python.NET tonight, since I'm at a > CPython2.7 computer. I couldn't find a 2.7 port of Python.NET on SF, > even though I found a note about the changes necessary already being > available: > > http://sourceforge.net/tracker/?func=detail&aid=3094895&group_id=162464&atid=823894 > > > /Olof > > PS. I'd love to help somehow with this project, since my day-time work > is with a C# program, and I'm trying to integrate Python into "the > loop" more and more. DS > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: From Sharon.Rozenblum at sandisk.com Tue Mar 1 11:06:15 2011 From: Sharon.Rozenblum at sandisk.com (Sharon Rozenblum) Date: Tue, 1 Mar 2011 12:06:15 +0200 Subject: [Python.NET] How to show the Console window References: Message-ID: Hi! Is there a way to show the console window when running Python from C# (in order to see the Python outputs, when the c# project is not console application) Thanks, SHARON From: Sharon Rozenblum Sent: Monday, February 28, 2011 7:19 PM To: 'oleksii.bidiuk at gmail.com'; 'Benjamin Aranguren' Cc: 'pythondotnet at python.org' Subject: RE: [Python.NET] Setting PYTHONPATH from code Hi! Checked again and found that I had in the end of the module path string the char:"\". After deleting it - it works for me as oleksii.bidiuk said: string script = "import sys\nsys.path.insert(0, '" + + "')"); IntPtr pythonLock = AcquireLock(); RunSimpleString(script); ReleaseLock(pythonLock); ( with the "\n" delimiter!) Thanks to all! SHARON From: Sharon Rozenblum Sent: Monday, February 28, 2011 3:49 PM To: 'Benjamin Aranguren' Cc: pythondotnet at python.org Subject: RE: [Python.NET] Setting PYTHONPATH from code Hi! Tried after your mail. Does not change... Regarding the PYTHONPATH: I change it with code (System.Environment.SetEnvironmentVariable("PYTHONPATH",PathValue)) and it does not help me at the first run of the application. (I am getting Null value from the ImportModule) But, after closing the application & opening it again it works (event if changing the PYTHONPATH in the code) with the PYTHONPATH that was set in the run before... Any Idea? Thanks, SHARON From: baranguren at gmail.com [mailto:baranguren at gmail.com] On Behalf Of Benjamin Aranguren Sent: Sunday, February 27, 2011 6:08 PM To: Sharon Rozenblum Cc: pythondotnet at python.org Subject: Re: [Python.NET] Setting PYTHONPATH from code On Wed, Feb 23, 2011 at 5:37 AM, Sharon Rozenblum > wrote: Hi! Trying to do as you said: string script = "import sys\nsys.path.insert(0, '" + modulePath + "')"; Have you tried using a semi colon instead of new line? string script = "import sys; sys.path.insert(0, '" + modulePath + "')"; IntPtr pythonLock = PythonEngine.AcquireLock(); PythonEngine.RunSimpleString(script); PythonEngine.ReleaseLock(pythonLock); And then: IntPtr gs = PythonEngine.AcquireLock(); pyportal = PythonEngine.ImportModule(moduleName); if (pyportal == null) { ... } ... I got Null value from the ImportModule. When setting the PYTHONPATH manually in the system variables with the "modulePath" and opening the VS is works. Any idea? Thanks, SAHRON From: Oleksii Bidiuk [mailto:oleksii.bidiuk at gmail.com] Sent: Thursday, February 10, 2011 2:21 PM To: Sharon Rozenblum Cc: pythondotnet at python.org Subject: Re: [Python.NET] Setting PYTHONPATH from code Hi Sharon, What do you want to achieve with this? If you want to provide path for loading your own modules you can change the sys.path value by e.g. running a 'initialization' script with import sys sys.path.insert(0, 'your/own/path') You can build up the script above in C# by inserting the path you need and then performing e.g. RunSimpleString(