From Ludovic.Pochon-Guerin at statkraft.com Tue Jun 7 04:20:15 2016 From: Ludovic.Pochon-Guerin at statkraft.com (=?iso-8859-1?Q?Pochon-Gu=E9rin_Ludovic?=) Date: Tue, 7 Jun 2016 08:20:15 +0000 Subject: [Python.NET] Debugging .NET assembly from Python 3 Message-ID: Hi, Using Visual Studio 2015, I have a Python project and a C# DLL project. >From the Python code, I import and call functions from the C# class. When running in Debug, I am able to stop at breakpoints in the Python code, but not in the C# code. The debugger jumps over the calls as if no symbols were loaded. I would like to know if it is possible to stop at breakpoints in the C# code and how to setup it in Visual Studio. This feature works when using IronPython, but we want to use PythonDotNet from Miniconda3. Thanks Ludovic -------------- next part -------------- An HTML attachment was scrubbed... URL: From denis.akhiyarov at gmail.com Wed Jun 8 02:31:40 2016 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Wed, 8 Jun 2016 01:31:40 -0500 Subject: [Python.NET] Debugging .NET assembly from Python 3 In-Reply-To: References: Message-ID: There are many conversations (both codeplex and github) recorded in issue tracker for PTVS about debugging pythonnet code. The starting point is to ensure that you are on .NET 4+, select manually managed, native, and python debugger engines. Also make sure that managed compatibility mode is not selected. Finally make sure that your python debug symbols are available to PTVS/VS for cross-language debugging. Note that currently the PTVS remote debugger is not working for pythonnet when debugging python code. On Tue, Jun 7, 2016 at 3:20 AM, Pochon-Gu?rin Ludovic < Ludovic.Pochon-Guerin at statkraft.com> wrote: > Hi, > > > > Using Visual Studio 2015, I have a Python project and a C# DLL project. > > From the Python code, I import and call functions from the C# class. > > When running in Debug, I am able to stop at breakpoints in the Python > code, but not in the C# code. > > The debugger jumps over the calls as if no symbols were loaded. > > > > I would like to know if it is possible to stop at breakpoints in the C# > code and how to setup it in Visual Studio. > > > > This feature works when using IronPython, but we want to use PythonDotNet > from Miniconda3. > > > > Thanks > > Ludovic > > > > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > https://mail.python.org/mailman/listinfo/pythondotnet > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Ludovic.Pochon-Guerin at statkraft.com Tue Jun 14 05:46:58 2016 From: Ludovic.Pochon-Guerin at statkraft.com (=?utf-8?B?UG9jaG9uLUd1w6lyaW4gTHVkb3ZpYw==?=) Date: Tue, 14 Jun 2016 09:46:58 +0000 Subject: [Python.NET] Debugging .NET assembly from Python 3 In-Reply-To: References: Message-ID: Thank you for your answer, I tried all of this without success. What do you mean by ?select manually managed debugger?? Please can you clarify if it is possible to stop at breakpoints in C# code when called from Python code (using python dot net)? Thanks Ludovic From: PythonDotNet [mailto:pythondotnet-bounces+ludovic.pochon-guerin=statkraft.com at python.org] On Behalf Of Denis Akhiyarov Sent: 8. juni 2016 08:32 To: A list for users and developers of Python for .NET Subject: Re: [Python.NET] Debugging .NET assembly from Python 3 There are many conversations (both codeplex and github) recorded in issue tracker for PTVS about debugging pythonnet code. The starting point is to ensure that you are on .NET 4+, select manually managed, native, and python debugger engines. Also make sure that managed compatibility mode is not selected. Finally make sure that your python debug symbols are available to PTVS/VS for cross-language debugging. Note that currently the PTVS remote debugger is not working for pythonnet when debugging python code. On Tue, Jun 7, 2016 at 3:20 AM, Pochon-Gu?rin Ludovic > wrote: Hi, Using Visual Studio 2015, I have a Python project and a C# DLL project. From the Python code, I import and call functions from the C# class. When running in Debug, I am able to stop at breakpoints in the Python code, but not in the C# code. The debugger jumps over the calls as if no symbols were loaded. I would like to know if it is possible to stop at breakpoints in the C# code and how to setup it in Visual Studio. This feature works when using IronPython, but we want to use PythonDotNet from Miniconda3. Thanks Ludovic _________________________________________________ Python.NET mailing list - PythonDotNet at python.org https://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: From denis.akhiyarov at gmail.com Tue Jun 14 10:48:52 2016 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Tue, 14 Jun 2016 09:48:52 -0500 Subject: [Python.NET] Debugging .NET assembly from Python 3 In-Reply-To: References: Message-ID: I regularly debugging C# code called from python side using pythonnet. So something is likely wrong in your settings. Here is how you set debugger engines (see picture in the comments): https://github.com/Microsoft/PTVS/issues/674 This mailing list is super-slowly approved for new messages. You may get much faster and better response on PTVS issue tracker: https://github.com/Microsoft/PTVS/issues/new Just provide Microsoft Python team with reproducible example. Also mention what symbols you see in Debugger "Modules" window. If issue is very specific to pythonnet and works on ironpython, then you can use pythonnet issue tracker: https://github.com/pythonnet/pythonnet/issues/new Note that PTVS has very specialized code for debugging IronPython, while pythonnet debugging happens through CPython debugger. On Tue, Jun 14, 2016 at 4:46 AM, Pochon-Gu?rin Ludovic < Ludovic.Pochon-Guerin at statkraft.com> wrote: > Thank you for your answer, > > > > I tried all of this without success. > > > > What do you mean by ?select manually managed debugger?? > > > > Please can you clarify if it is possible to stop at breakpoints in C# code > when called from Python code (using python dot net)? > > > > Thanks > > Ludovic > > > > > > *From:* PythonDotNet [mailto:pythondotnet-bounces+ludovic.pochon-guerin= > statkraft.com at python.org] *On Behalf Of *Denis Akhiyarov > *Sent:* 8. juni 2016 08:32 > *To:* A list for users and developers of Python for .NET > *Subject:* Re: [Python.NET] Debugging .NET assembly from Python 3 > > > > There are many conversations (both codeplex and github) recorded in issue > tracker for PTVS about debugging pythonnet code. > > > > The starting point is to ensure that you are on .NET 4+, select manually > managed, native, and python debugger engines. Also make sure that managed > compatibility mode is not selected. Finally make sure that your python > debug symbols are available to PTVS/VS for cross-language debugging. > > > > Note that currently the PTVS remote debugger is not working for pythonnet > when debugging python code. > > > > > > On Tue, Jun 7, 2016 at 3:20 AM, Pochon-Gu?rin Ludovic < > Ludovic.Pochon-Guerin at statkraft.com> wrote: > > Hi, > > > > Using Visual Studio 2015, I have a Python project and a C# DLL project. > > From the Python code, I import and call functions from the C# class. > > When running in Debug, I am able to stop at breakpoints in the Python > code, but not in the C# code. > > The debugger jumps over the calls as if no symbols were loaded. > > > > I would like to know if it is possible to stop at breakpoints in the C# > code and how to setup it in Visual Studio. > > > > This feature works when using IronPython, but we want to use PythonDotNet > from Miniconda3. > > > > Thanks > > Ludovic > > > > > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > https://mail.python.org/mailman/listinfo/pythondotnet > > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > https://mail.python.org/mailman/listinfo/pythondotnet > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Ludovic.Pochon-Guerin at statkraft.com Thu Jun 16 09:13:12 2016 From: Ludovic.Pochon-Guerin at statkraft.com (=?utf-8?B?UG9jaG9uLUd1w6lyaW4gTHVkb3ZpYw==?=) Date: Thu, 16 Jun 2016 13:13:12 +0000 Subject: [Python.NET] Debugging .NET assembly from Python 3 In-Reply-To: References: Message-ID: Thank you for your help. It is not possible to attach to the Python process the way explained in PTVS discussion, because it is greyed. I think it is because I am already running the python process when starting debugger from python file in Visual Studio I think my problem is due to the Python environment. I use Miniconda3 and not CPython interpreter in Visual Studio. It might be something to do with the CLR module too. Unfortunately I don?t have time to investigate further and will have to work without debugging for the time being. Thanks anyway Ludovic From: PythonDotNet [mailto:pythondotnet-bounces+ludovic.pochon-guerin=statkraft.com at python.org] On Behalf Of Denis Akhiyarov Sent: 14. juni 2016 16:49 To: A list for users and developers of Python for .NET Subject: Re: [Python.NET] Debugging .NET assembly from Python 3 I regularly debugging C# code called from python side using pythonnet. So something is likely wrong in your settings. Here is how you set debugger engines (see picture in the comments): https://github.com/Microsoft/PTVS/issues/674 This mailing list is super-slowly approved for new messages. You may get much faster and better response on PTVS issue tracker: https://github.com/Microsoft/PTVS/issues/new Just provide Microsoft Python team with reproducible example. Also mention what symbols you see in Debugger "Modules" window. If issue is very specific to pythonnet and works on ironpython, then you can use pythonnet issue tracker: https://github.com/pythonnet/pythonnet/issues/new Note that PTVS has very specialized code for debugging IronPython, while pythonnet debugging happens through CPython debugger. On Tue, Jun 14, 2016 at 4:46 AM, Pochon-Gu?rin Ludovic > wrote: Thank you for your answer, I tried all of this without success. What do you mean by ?select manually managed debugger?? Please can you clarify if it is possible to stop at breakpoints in C# code when called from Python code (using python dot net)? Thanks Ludovic From: PythonDotNet [mailto:pythondotnet-bounces+ludovic.pochon-guerin=statkraft.com at python.org] On Behalf Of Denis Akhiyarov Sent: 8. juni 2016 08:32 To: A list for users and developers of Python for .NET Subject: Re: [Python.NET] Debugging .NET assembly from Python 3 There are many conversations (both codeplex and github) recorded in issue tracker for PTVS about debugging pythonnet code. The starting point is to ensure that you are on .NET 4+, select manually managed, native, and python debugger engines. Also make sure that managed compatibility mode is not selected. Finally make sure that your python debug symbols are available to PTVS/VS for cross-language debugging. Note that currently the PTVS remote debugger is not working for pythonnet when debugging python code. On Tue, Jun 7, 2016 at 3:20 AM, Pochon-Gu?rin Ludovic > wrote: Hi, Using Visual Studio 2015, I have a Python project and a C# DLL project. From the Python code, I import and call functions from the C# class. When running in Debug, I am able to stop at breakpoints in the Python code, but not in the C# code. The debugger jumps over the calls as if no symbols were loaded. I would like to know if it is possible to stop at breakpoints in the C# code and how to setup it in Visual Studio. This feature works when using IronPython, but we want to use PythonDotNet from Miniconda3. Thanks Ludovic _________________________________________________ Python.NET mailing list - PythonDotNet at python.org https://mail.python.org/mailman/listinfo/pythondotnet _________________________________________________ Python.NET mailing list - PythonDotNet at python.org https://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: From denis.akhiyarov at gmail.com Sun Jun 19 14:05:22 2016 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Sun, 19 Jun 2016 13:05:22 -0500 Subject: [Python.NET] pyinstaller + pythonnet In-Reply-To: References: Message-ID: An pull request was merged to pyinstaller hook for clr (pythonnet): https://github.com/pyinstaller/pyinstaller/pull/2048/files The proper way to use this clr hook is to specify --hidden-import=clr from command-line or hiddenimports=['clr'] in spec file. This should take care of finding Python.Runtime.DLL hidden import for Windows. If anyone is willing to tackle bundling on Linux or OSX, then please go ahead! Note that Mono is not pre-installed on these platforms, hence bundling could get very complicated. Thanks, Denis On Wed, Mar 16, 2016 at 10:15 AM, Denis Akhiyarov wrote: > Just add path to Python.Runtime.dll in your spec file using "datas" > option. I guess pyinstaller only adds clr.pyd. > > On Tuesday, March 15, 2016, Nikhil Garg wrote: > >> Hi All, >> >> I tried to build a very simple executable using pyinstaller, where my >> script just imported clr module. I managed to build the executable but then >> the executable doesnt run. I have posted the error below. I think the >> executable is able to find the runtime dll but it is unable to run it. >> >> >> Unhandled Exception: System.IO.FileLoadException: Could not load file or >> assembl >> y 'Python.Runtime, Version=4.0.0.1, Culture=neutral, >> PublicKeyToken=5000fea6cba7 >> 02dd' or one of its dependencies. The located assembly's manifest >> definition doe >> s not match the assembly reference. (Exception from HRESULT: 0x80131040) >> at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, >> String cod >> eBase, Evidence assemblySecurity, RuntimeAssembly locationHint, >> StackCrawlMark& >> stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean >> forIntro >> spection, Boolean suppressSecurityChecks) >> at >> System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName as >> semblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, >> StackCrawlMar >> k& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, >> Boolean forIn >> trospection, Boolean suppressSecurityChecks) >> at System.Reflection.Assembly.Load(AssemblyName assemblyRef) >> at clrModule.initclr() >> >> >> I would appreciate any help >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From denis.akhiyarov at gmail.com Thu Jun 30 13:25:31 2016 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Thu, 30 Jun 2016 12:25:31 -0500 Subject: [Python.NET] upcoming talk about pythonnet at PyOhio Message-ID: http://pyohio.org/schedule/presentation/240/ Saturday 10:30 a.m.?11:20 a.m.Integrating Python into the CLR with Python for .NETHussein Farran Audience level:IntermediateDescription Python for .NET is a project dedicated to being able to call into Python from the CLR. Where IronPython has fallen off as the .NET Python prodigal son Python for .NET has picked up the slack. Python for .NET (or pythonnet for short) is an integration of the C Python engine with .NET. We'll be going through the uses and methods of integration of Python with your .NET projects. Abstract This talk covers embedding Python into the .NET runtime as well as running Python from your .NET code. It will be in C# on the .NET side. It will cover topics such as embedding Python, purposes for scripting, script security, and script/embedded code speeds. I will also cover IronPython and provide a comparison and analysis of how it compares with Python for .NET. This may include talking notes about the implementation of IronPython as well as benchmark comparisons. Hussein Farran Hussein Farran is relatively new to the professional IT world, but he?s doing his best to come in blazing. While building his experience Hussein strives to forge connections with those more experienced and to pass on what he knows to those less experienced. As a Software Developer at UseTech Design, Hussein has the opportunity to dip into many project types and to learn from a varied cast of co-workers and mentors. -------------- next part -------------- An HTML attachment was scrubbed... URL: