From fernandez_dan2 at hotmail.com Mon Aug 3 23:33:45 2015 From: fernandez_dan2 at hotmail.com (Daniel Fernandez) Date: Mon, 3 Aug 2015 15:33:45 -0600 Subject: [Python.NET] Setup sys.path in Embedded Application Message-ID: Hi Everyone, I'm looking at embedding python in my .NET app. I was wondering what is the best practice for adding additional paths to the sys.path? I want the standard python sys path but additional paths for my own python scripts. Do I just Py.Import("sys") and then add it there or is there some other way? Thanks. Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: From mc at mclaveau Thu Aug 6 10:38:44 2015 From: mc at mclaveau (mc at mclaveau) Date: Thu, 6 Aug 2015 10:38:44 +0200 Subject: [Python.NET] Setup sys.path in Embedded Application In-Reply-To: References: Message-ID: <55C31D14.1040304@mclaveau.com> Le 03.08.15 23:33, Daniel Fernandez a ?crit : > > Hi Everyone, > > I?m looking at embedding python in my .NET app. I was wondering what > is the best practice for adding additional paths to the sys.path? I > want the standard python sys path but additional paths for my own > python scripts. Do I just Py.Import(?sys?) and then add it there or is > there some other way? > > Thanks. > > Danny > Hi! Had you try : sys.path.append(myPathDir) at beginning of your scripts? @-salutations -- Michel Claveau -------------- next part -------------- An HTML attachment was scrubbed... URL: From fernandez_dan2 at hotmail.com Fri Aug 7 03:00:11 2015 From: fernandez_dan2 at hotmail.com (Daniel Fernandez) Date: Thu, 6 Aug 2015 19:00:11 -0600 Subject: [Python.NET] Setup sys.path in Embedded Application In-Reply-To: <55C31D14.1040304@mclaveau.com> References: , <55C31D14.1040304@mclaveau.com> Message-ID: Hi, Thanks for the input. I wanted my bootstrapper for my C# application to setup Python Engine but I guess I could create like a startup script that it calls to sys path and anything else I need to. Thanks. Danny To: pythondotnet at python.org From: mclaveau mc at mclaveau.com Date: Thu, 6 Aug 2015 10:38:44 +0200 Subject: Re: [Python.NET] Setup sys.path in Embedded Application Le 03.08.15 23:33, Daniel Fernandez a ?crit : Hi Everyone, I?m looking at embedding python in my .NET app. I was wondering what is the best practice for adding additional paths to the sys.path? I want the standard python sys path but additional paths for my own python scripts. Do I just Py.Import(?sys?) and then add it there or is there some other way? Thanks. Danny Hi! Had you try : sys.path.append(myPathDir) at beginning of your scripts? @-salutations -- Michel Claveau _________________________________________________ Python.NET mailing list - PythonDotNet at python.org https://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: From mizrahi.jonathan at gmail.com Sun Aug 16 03:53:01 2015 From: mizrahi.jonathan at gmail.com (Jonathan Mizrahi) Date: Sat, 15 Aug 2015 21:53:01 -0400 Subject: [Python.NET] bug in exception handling Message-ID: Hi, I may have found a bug in how the clr package converts .net exceptions to Python exceptions, at least as it relates to PyQt. If I try and add a library which does not exist, and then try and print the exception, PyQt is subsequently unable to initialize OLE. This means that PyQt applications cannot use copy/paste and drag-and-drop. Here is a minimal example: import clr import sys from PyQt4 import QtGui try: clr.AddReference('foo') #This doesn't exist except Exception as e: print e app = QtGui.QApplication(sys.argv) app.exec_() This results in the Qt error: Qt: Could not initialize OLE (error 80010106) The program runs, but copy/paste and drag-and-drop fails. If I do not try and print the exception (replace the except block with 'pass'), the program runs without any problems. Also, if the library exists I have no problems. Is this something anyone has seen before? Thanks! Jonathan Mizrahi -------------- next part -------------- An HTML attachment was scrubbed... URL: