From mynet101 at 163.com Thu Mar 3 03:30:17 2016 From: mynet101 at 163.com (mynet101) Date: Thu, 3 Mar 2016 16:30:17 +0800 Subject: [Ironpython-users] error of import pandas Message-ID: <000901d17526$ed520ec0$c7f62c40$@163.com> Hi IronPython team, I am previously a C# developer and want to involve Python. May I ask 2 short questions, please? 1. On basis of documents available for me, it seems that IronPython now only supports Python2.7, is there a plan to make IronPython support Python3.x? 2. When using IronPython2.7 in VS, It seems that it errors when calling for other Python modules, such as it errors as attached when I try to import Pandas (code: import pandas as pd), do you know how to fix it? I am using Visual Studio2013 + PTVS + IronPython2.7 + Pandas0.17.1 Many thanks in advance! Jerry Li -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Python error.png Type: image/png Size: 9257 bytes Desc: not available URL: From deedeebernard at hotmail.com Fri Mar 11 16:46:45 2016 From: deedeebernard at hotmail.com (Didier Bernard) Date: Fri, 11 Mar 2016 21:46:45 +0000 Subject: [Ironpython-users] How to remove every second row and column of cells from the grid of a raster in GDAL? Message-ID: Is it possible to resample the raster by using GDAL C# binaries, in a way that every other cell in a row and column is removed? Basically a replication of this GDAL command: gdal_translate -outsize 50% 0 input.tif output.tif Thank you for the reply. Didier Bernard -------------- next part -------------- An HTML attachment was scrubbed... URL: From buckle2000 at 163.com Sat Mar 19 10:29:37 2016 From: buckle2000 at 163.com (buckle2000) Date: Sat, 19 Mar 2016 22:29:37 +0800 Subject: [Ironpython-users] How to bind a System.Type to a variable using scope.SetVariable? Message-ID: <5ad674af.f438.1538f480f0e.Coremail.buckle2000@163.com> Hello everyone! I want to bind a class in C# (or a System.Type) to a variable in IronPython using scope.SetVariable. For example, import System math = System.Math math.Sin(1) # this works type(math) # IronPython.Runtime.Types.PythonType But, I do not want to use "import xxx" due to security problems. I want the "math" class, in this example, can be use instantly. When I tried to do something like this in C#: ?scope.SetVariable("math",typeof(System.Math)); then in python code type(math) # Also IronPython.Runtime.Types.PythonType See the attached source file for detailed info. Something may be useful: see IronPython.Modules.Builtin, which is also a static class like System.Math. seems like IronPython binded it with "__builtins__" in python successfully, but I don't know how. Another question: is there an easy way to disable users from importing modules like clr without using Code Access? Also, how to bind a namespace in C# code, to a ironpython object, using IronPython C# assembly (so the "binding" code must be written in C#(.NET) code)? 2016-03-19 buckle2000 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Program.cs Type: application/octet-stream Size: 825 bytes Desc: not available URL: From m.schaber at codesys.com Tue Mar 29 03:03:42 2016 From: m.schaber at codesys.com (Markus Schaber) Date: Tue, 29 Mar 2016 07:03:42 +0000 Subject: [Ironpython-users] How to bind a System.Type to a variable using scope.SetVariable? In-Reply-To: <5ad674af.f438.1538f480f0e.Coremail.buckle2000@163.com> References: <5ad674af.f438.1538f480f0e.Coremail.buckle2000@163.com> Message-ID: <727D8E16AE957149B447FE368139F2B5A5779688@SERVER10> Hi, Buckle, I?m trying to do some guesswork, as I could not find a clear question in the first part. I guess you?re using a ?hosted? environment, where the IronPython interpreter is hosted in a C# / .NET application. There?s the method DynamicHelpers.GetPythonTypeFromType(Type dotNetType) which creates a python class object for a .NET type. We successfully used this to provide types (including enums) to IronPython scripts. You can either inject them directly into the script scope, or create an artificial module using ScriptEngine.CreateModule(string name) and populate its namespace with mymodule.SetVariable(name, value), which the script can then ?import?. 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 buckle2000 Sent: Tuesday, March 22, 2016 5:42 PM To: ironpython-users Subject: [Ironpython-users] How to bind a System.Type to a variable using scope.SetVariable? Hello everyone! I want to bind a class in C# (or a System.Type) to a variable in IronPython using scope.SetVariable. For example, import System math = System.Math math.Sin(1) # this works type(math) # IronPython.Runtime.Types.PythonType But, I do not want to use "import xxx" due to security problems. I want the "math" class, in this example, can be use instantly. When I tried to do something like this in C#: ?scope.SetVariable("math",typeof(System.Math)); then in python code type(math) # Also IronPython.Runtime.Types.PythonType See the attached source file for detailed info. Something may be useful: see IronPython.Modules.Builtin, which is also a static class like System.Math. seems like IronPython binded it with "__builtins__" in python successfully, but I don't know how. Another question: is there an easy way to disable users from importing modules like clr without using Code Access? Also, how to bind a namespace in C# code, to a ironpython object, using IronPython C# assembly (so the "binding" code must be written in C#(.NET) code)? 2016-03-19 ________________________________ buckle2000 -------------- next part -------------- An HTML attachment was scrubbed... URL: