From stephane.lozier at gmail.com Mon Apr 4 20:32:03 2016 From: stephane.lozier at gmail.com (=?UTF-8?Q?St=C3=A9phane_Lozier?=) Date: Mon, 4 Apr 2016 20:32:03 -0400 Subject: [Ironpython-users] Executing scripts in parallel In-Reply-To: References: Message-ID: Has anyone looked at executing scripts in parallel from C# using the same ScriptEngine? I tried without much success and I was wondering if it's just not something the engine can do, or if by tightening up thread safety in a few places it could be made to work properly. St?phane -------------- next part -------------- An HTML attachment was scrubbed... URL: From dasaratharamu.rachapudi at gm.com Wed Apr 13 10:22:50 2016 From: dasaratharamu.rachapudi at gm.com (Dasaratha Ramu Rachapudi (C)) Date: Wed, 13 Apr 2016 14:22:50 +0000 Subject: [Ironpython-users] How to override the __file__ path in c#? Message-ID: <04ff1b71b05b491faf634f843742eea6@DCMIPPEXCH058.nam.corp.gm.com> Hi, How to override the python's __file__ variables path (with a custom path rather than the current executing script path) in c#? I want to do this before the python script execution through c#. I am using the following code snippet for overriding the __file__ variable. Please let me know if this is the correct approach or not ScriptScope scope2; scope2.SetVariable("__file__", "c:/temp"); When we execute the python script this is being overwritten by python automatically (to current executing script path) and I am not able to get the c:/temp path from the __file__ variable. Please help me resolve this issue. Thanks & Regards, Dasaratha R Nothing in this message is intended to constitute an electronic signature unless a specific statement to the contrary is included in this message. Confidentiality Note: This message is intended only for the person or entity to which it is addressed. It may contain confidential and/or privileged material. Any review, transmission, dissemination or other use, or taking of any action in reliance upon this message by persons or entities other than the intended recipient is prohibited and may be unlawful. If you received this message in error, please contact the sender and delete it from your computer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.schaber at codesys.com Thu Apr 21 03:09:07 2016 From: m.schaber at codesys.com (Markus Schaber) Date: Thu, 21 Apr 2016 07:09:07 +0000 Subject: [Ironpython-users] How to override the __file__ path in c#? In-Reply-To: <04ff1b71b05b491faf634f843742eea6@DCMIPPEXCH058.nam.corp.gm.com> References: <04ff1b71b05b491faf634f843742eea6@DCMIPPEXCH058.nam.corp.gm.com> Message-ID: <727D8E16AE957149B447FE368139F2B5A84BE94F@SERVER10> Hi, Dasaratha, As far as I can see, you will need to use a deeper layer of the API. Some of the Microsoft.Scripting.Hosting.ScriptEngine.CreateScriptSourceXXX() methods get a ?path? argument which should be the one which ends up as the __file__ variable. You could use CreateScriptSourceFromString() or the CreateScriptSource() overloads, where you pass the script contents explicitly. To get the ScriptEngine instance, use the IronpPython.Hosting.Python.CreateEngine() methods. Best regards Markus Schaber CODESYS? a trademark of 3S-Smart Software Solutions GmbH Inspiring Automation Solutions ________________________________ 3S-Smart Software Solutions GmbH Dipl.-Inf. Markus Schaber | Product Development Core Technology Memminger Str. 151 | 87439 Kempten | Germany Tel. +49-831-54031-979 | Fax +49-831-54031-50 E-Mail: m.schaber at codesys.com | Web: codesys.com | CODESYS store: store.codesys.com CODESYS forum: forum.codesys.com Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 ________________________________ This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. From: Ironpython-users [mailto:ironpython-users-bounces+m.schaber=codesys.com at python.org] On Behalf Of Dasaratha Ramu Rachapudi (C) Sent: Wednesday, April 20, 2016 10:12 PM To: ironpython-users at python.org Subject: [Ironpython-users] How to override the __file__ path in c#? Hi, How to override the python?s __file__ variables path (with a custom path rather than the current executing script path) in c#? I want to do this before the python script execution through c#. I am using the following code snippet for overriding the __file__ variable. Please let me know if this is the correct approach or not ScriptScope scope2; scope2.SetVariable("__file__", "c:/temp"); When we execute the python script this is being overwritten by python automatically (to current executing script path) and I am not able to get the c:/temp path from the __file__ variable. Please help me resolve this issue. Thanks & Regards, Dasaratha R Nothing in this message is intended to constitute an electronic signature unless a specific statement to the contrary is included in this message. Confidentiality Note: This message is intended only for the person or entity to which it is addressed. It may contain confidential and/or privileged material. Any review, transmission, dissemination or other use, or taking of any action in reliance upon this message by persons or entities other than the intended recipient is prohibited and may be unlawful. If you received this message in error, please contact the sender and delete it from your computer. -------------- next part -------------- An HTML attachment was scrubbed... URL: