From phat.loc at gmail.com Thu Mar 15 21:59:18 2018 From: phat.loc at gmail.com (Phat Loc) Date: Thu, 15 Mar 2018 21:59:18 -0400 Subject: [Python.NET] Embedding Python Question Message-ID: Hi All, I get a bunch of Exception thrown: 'System.IO.FileLoadException' in mscorlib.dll and the call never returns after PythonEngine.Initialize(); PythonEngine.Exec("import IPython"); Any suggestions on how to debug it? If run import IPython from the Console app that comes with solution it works fine. Am I missing some settings when I Initialize the PythonEngine vs Runtime.Py_Main? How do I determine what is causing the error? Thanks, Phat -------------- next part -------------- An HTML attachment was scrubbed... URL: From phat.loc at gmail.com Fri Mar 16 14:39:57 2018 From: phat.loc at gmail.com (Phat Loc) Date: Fri, 16 Mar 2018 14:39:57 -0400 Subject: [Python.NET] PythonEngine a singleton? Message-ID: Hi All, I new to to Python and PythonDotNet. However, I am able to embed it in a clr application. Should the PythonEngine be treated as sigleton? When does it make sense to create an instance of the PythonEngine versus just calling the static methods? Thanks, Phat -------------- next part -------------- An HTML attachment was scrubbed... URL: From denis.akhiyarov at gmail.com Fri Mar 16 23:11:09 2018 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Sat, 17 Mar 2018 03:11:09 +0000 Subject: [Python.NET] PythonEngine a singleton? In-Reply-To: References: Message-ID: You should treat PythonEngine as Singleton, for your use case search for PyScope in pythonnet repo on GitHub: https://github.com/pythonnet/pythonnet/search?utf8=?&q=pyscope&type= On Fri, Mar 16, 2018, 1:40 PM Phat Loc wrote: > Hi All, > > I new to to Python and PythonDotNet. However, I am able to embed it in a > clr application. Should the PythonEngine be treated as sigleton? When does > it make sense to create an instance of the PythonEngine versus just > calling the static methods? > > Thanks, > > Phat > _________________________________________________ > 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 Fri Mar 16 23:15:44 2018 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Sat, 17 Mar 2018 03:15:44 +0000 Subject: [Python.NET] Embedding Python Question In-Reply-To: References: Message-ID: This looks like an issue, you can report it on GitHub. On Thu, Mar 15, 2018, 8:59 PM Phat Loc wrote: > Hi All, > > I get a bunch of > > Exception thrown: 'System.IO.FileLoadException' in mscorlib.dll > > and the call never returns after > > PythonEngine.Initialize(); > > PythonEngine.Exec("import IPython"); > > > Any suggestions on how to debug it? If run import IPython from the > Console app that comes with solution it works fine. Am I missing some > settings when I Initialize the PythonEngine vs Runtime.Py_Main? How do I > determine what is causing the error? > > > Thanks, > > > Phat > > > > > > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > https://mail.python.org/mailman/listinfo/pythondotnet > -------------- next part -------------- An HTML attachment was scrubbed... URL: From techieth at gmail.com Fri Mar 16 07:08:38 2018 From: techieth at gmail.com (techi eth) Date: Fri, 16 Mar 2018 16:38:38 +0530 Subject: [Python.NET] Pythondotnet release for Mono Message-ID: Hi, I would like to know which is python for dot net release will build & works with mono. I am trying with Mono4.0.0 on Ubuntu14.04 but getting building error. Any link with right version or right build steps will be helpful. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From denis.akhiyarov at gmail.com Fri Mar 16 23:38:20 2018 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Sat, 17 Mar 2018 03:38:20 +0000 Subject: [Python.NET] Pythondotnet release for Mono In-Reply-To: References: Message-ID: See Travis CI settings for pythonnet on GitHub, which includes Ubuntu image version and Mono version. Mono 4.0 is differently out of date. Not sure about Ubuntu version. On Fri, Mar 16, 2018, 10:19 PM techi eth wrote: > Hi, > > I would like to know which is python for dot net release will build & > works with mono. > > I am trying with Mono4.0.0 on Ubuntu14.04 but getting building error. > Any link with right version or right build steps will be helpful. > > Thanks > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > https://mail.python.org/mailman/listinfo/pythondotnet > -------------- next part -------------- An HTML attachment was scrubbed... URL: From techieth at gmail.com Mon Mar 19 03:40:13 2018 From: techieth at gmail.com (techi eth) Date: Mon, 19 Mar 2018 13:10:13 +0530 Subject: [Python.NET] Calling Python script from dotnet Message-ID: Hi, How i can use calling python script from dotnet by using pythondotnet framwork ? I would like to pass some dotnet Object to python script & take return of dotnet object one script execution is over to dotnet code. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From phat.loc at gmail.com Mon Mar 19 09:42:13 2018 From: phat.loc at gmail.com (Phat Loc) Date: Mon, 19 Mar 2018 09:42:13 -0400 Subject: [Python.NET] Python.Runtime.dll Embedded Resource & AssemblyLoader Message-ID: Hi All, I am embedding Python in a clr application. Do I need to include Python.Runtime.dll as an Embedded Resource? If so why? It does seem to work with just a reference to the Python.Runtime Assembly. Also do I also need to create an AssemblyLoader like the one in the Console application in the pythonnet solution? Thanks, Phat -------------- next part -------------- An HTML attachment was scrubbed... URL: From denis.akhiyarov at gmail.com Mon Mar 19 11:09:43 2018 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Mon, 19 Mar 2018 15:09:43 +0000 Subject: [Python.NET] Calling Python script from dotnet In-Reply-To: References: Message-ID: Did you look at GitHub pythonnet readme? On Mon, Mar 19, 2018, 2:40 AM techi eth wrote: > Hi, > > How i can use calling python script from dotnet by using pythondotnet > framwork ? > > I would like to pass some dotnet Object to python script & take return of > dotnet object one script execution is over to dotnet code. > > Thanks > _________________________________________________ > 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 Mon Mar 19 11:09:00 2018 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Mon, 19 Mar 2018 15:09:00 +0000 Subject: [Python.NET] Python.Runtime.dll Embedded Resource & AssemblyLoader In-Reply-To: References: Message-ID: You don't have to use embedded resources or assembly loader. Just using reference is OK. On Mon, Mar 19, 2018, 8:42 AM Phat Loc wrote: > Hi All, > > I am embedding Python in a clr application. Do I need to > include Python.Runtime.dll as an Embedded Resource? If so why? It does seem > to work with just a reference to the Python.Runtime Assembly. Also do I > also need to create an AssemblyLoader like the one in the Console > application in the pythonnet solution? > > Thanks, > > Phat > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > https://mail.python.org/mailman/listinfo/pythondotnet > -------------- next part -------------- An HTML attachment was scrubbed... URL: From phat.loc at gmail.com Mon Mar 19 14:26:15 2018 From: phat.loc at gmail.com (Phat Loc) Date: Mon, 19 Mar 2018 14:26:15 -0400 Subject: [Python.NET] Runtime Callable Wrapper Interop Message-ID: Hi All, I want to be able to use the Runtime Callable Wrapper for the Excel application as I would in the CLR from C#. Maybe I am missing something because it does work partially. If I get reference to Runtime Callable Wrapper for an Excel Application COM object then I can call its methods and properties like a normal clr object. However if one of the property is another COM object e.g. ExcelApp.Cells then it would need to a marshal.createwrapperoftype for that. How would I get it to work like comtypes (http://pythonhosted.org/comtypes/) but using the CLR wrapper instead of COM directly? Do I need to modify the python runtime in order to handle this use case or is there an easier way? Thanks, Phat -------------- next part -------------- An HTML attachment was scrubbed... URL: From phat.loc at gmail.com Mon Mar 19 16:50:31 2018 From: phat.loc at gmail.com (Phat Loc) Date: Mon, 19 Mar 2018 16:50:31 -0400 Subject: [Python.NET] Indexer not working on Interop Message-ID: Hi All, I was expecting the code below to work. Basically I casting a System.__ComObject into a Range Interface ( https://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.range_members(v=office.14).aspx). There should be an indexer but I can't seem to get it to work? Thanks, Phat from PyExcel import PyAddin import Microsoft.Office.Interop.Excel as Excel app = Excel._Application(PyAddin.CurrentInstance.ExcelApp) selection = Excel.Range(app.Selection) In [5]: selection[1,1] --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in () ----> 1 selection[1,1] TypeError: 'Range' object is not subscriptable In [6]: selection.Cells[1,1] --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in () ----> 1 selection.Cells[1,1] TypeError: unindexable object In [7]: selection.Cells(1,1) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in () ----> 1 selection.Cells(1,1) TypeError: object is not callable -------------- next part -------------- An HTML attachment was scrubbed... URL: From antongyang at yahoo.com Tue Mar 20 00:53:29 2018 From: antongyang at yahoo.com (Andrew Yang) Date: Tue, 20 Mar 2018 04:53:29 +0000 (UTC) Subject: [Python.NET] Creating an Installer for C# Apps that use Python.Runtime References: <19995800.3746875.1521521609642.ref@mail.yahoo.com> Message-ID: <19995800.3746875.1521521609642@mail.yahoo.com> Hi All, This might be a really dumb question, but I was wondering how can I create an installer for a C# wpf?app, that uses pythonnet's?Python.Runtime.dll?? Currently, I've created a python module, imported the module in?"using (Py.GIL())", and called some functions I've written. What methods are there to allow a user who does not have Python installed to be able to install and use my app (with or without having to install python)? I'm not sure if this is relevant, but I'm only importing from modules?I've written or __builtin__ in?the module used in my C# app. Additionally, is the?Python.Runtime.dll that I build on my machine compatible with my users'? Best regards,Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: From denis.akhiyarov at gmail.com Tue Mar 20 09:46:09 2018 From: denis.akhiyarov at gmail.com (Denis Akhiyarov) Date: Tue, 20 Mar 2018 13:46:09 +0000 Subject: [Python.NET] Creating an Installer for C# Apps that use Python.Runtime In-Reply-To: <19995800.3746875.1521521609642@mail.yahoo.com> References: <19995800.3746875.1521521609642.ref@mail.yahoo.com> <19995800.3746875.1521521609642@mail.yahoo.com> Message-ID: You can use Wix setup from Beeware Briefcase project: https://github.com/pybee/briefcase/blob/master/docs/background/getting-started.rst And some discussion here: https://github.com/pybee/briefcase/issues/30 On Tue, Mar 20, 2018, 8:40 AM Andrew Yang via PythonDotNet < pythondotnet at python.org> wrote: > Hi All, > > This might be a really dumb question, but I was wondering how can I create > an installer for a C# wpf app, that uses pythonnet's Python.Runtime.dll? > > Currently, I've created a python module, imported the module in "using > (Py.GIL())", and called some functions I've written. What methods are there > to allow a user who does not have Python installed to be able to install > and use my app (with or without having to install python)? I'm not sure if > this is relevant, but I'm only importing from modules I've written or > __builtin__ in the module used in my C# app. > > Additionally, is the Python.Runtime.dll that I build on my machine > compatible with my users'? > > Best regards, > Andrew > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > https://mail.python.org/mailman/listinfo/pythondotnet > -------------- next part -------------- An HTML attachment was scrubbed... URL: