ironpython

IronPython cannot import module os

亡梦爱人 提交于 2019-12-19 04:09:39
问题 So I have a basic ZIPPED IronPython (2.6 or 2.6.1) that I just unzip, start ipy.exe, type "import os" and hit enter. The following output happens: Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named os It doesn't work even if I import clr first. What's it to be done ? I've googled this issue but no relevant answer. The closest idea was this (which didn't work): import clr clr.AddReference("IronPython") clr.AddReference("IronPython.Modules")

How to atomically increment a static member in IronPython?

老子叫甜甜 提交于 2019-12-19 03:59:32
问题 I have an IronPython script that uses the TPL and Parallel.ForEach to process files using multiple threads. In C# I can use Interlocked.Add and Interlocked.Increment to change global variables in an atomic thread-safe operation, but this does not work in IronPython because integers are immutable. I currently have a simple Results class that stores a few variables as static members that are used to keep track of the results from a multi-threaded operation. When changing multiple values I can

How can I use –X:Frames in Ironpython?

我们两清 提交于 2019-12-18 17:29:08
问题 Visual Studio 2010 + Ironpython for .net4 I want to use numpy in ironpython, and they said I must use frames support. So, I should running ipy with -X:Frames or -X:FullFrames on the command line. But, I have two questions: 1.how can i use -X:Frames or -X:FullFrames in Ironpython Interactive console? 2.If I use C# 4 to load py which contained numpy, how can I use extern parameter like -X:Frames or -X:FullFrames? Thanks a lot. 回答1: IronPython Tools for Visual Studio has been deprecated by

Why do I get this .NET error - “TypeError: expected List[DataPoint], got List[DataPoint]”

試著忘記壹切 提交于 2019-12-18 09:46:12
问题 I refactored some code, and now I get this error when calling a function. But everything seems to be fine, I even compared failing_argument.GetType().AssemblyQualifiedName between the old and the new code and they are the same. Any ideas what could be wrong? The invocation of the function is in IronPython code, the function is in C# code (an assembly which didn't change during this refactoring). What sort of thing could generate this error? EDIT: full IronPython traceback: Traceback (most

Where is Microsoft.Scripting.Core.dll?

六月ゝ 毕业季﹏ 提交于 2019-12-18 06:56:25
问题 I installed IronPython 2.6.1 on Windows Vista x64 on a machine with Visual Studio 2010 installed. I expected to find these DLLs: Microsoft.Scripting.Core.dll Microsoft.Scripting.ExtensionAttribute.dll ... in the IronPython directory, but they are not there. Is this a difference between IronPython 2.6.0 and 2.6.1 or do I have a problem with my installation? Edit It has been suggested that I edit this question to explain why it is not a duplicate of How to use Microsoft.Scripting.Hosting? The

Accessing Pandas library using IronPython

会有一股神秘感。 提交于 2019-12-18 05:09:23
问题 I aim to connect Python to .NET for a process. I am using IronPython for it. The part in Python involves some calculations for which I use the Pandas library. Is there a way to connect IronPython and Pandas? I see using IronPython, I can access all the basic Python functionalities. How to extend this generally to access third party functionalities/packages (like Pandas here)? 回答1: Short answer: No. Longer answer: As far as I am aware tere is no way to integrate C-libraries with IronPython in

Django on IronPython

女生的网名这么多〃 提交于 2019-12-17 21:39:40
问题 I am interested in getting an install of Django running on IronPython, has anyone had any success getting this running with some level of success? If so can you please tell of your experiences, performance, suggest some tips, resources and gotchas? 回答1: Besides the Jeff Hardy blog post on Django + IronPython mentioned by Tony Meyer, it might be useful to also read Jeff's two other posts in the same series on his struggles with IronPython, easy_install and zlib. The first is Solving the zlib

Shuffle string c#

蓝咒 提交于 2019-12-17 20:17:43
问题 I want to know shuffle string Example string string word; //I want to shuffle it word = "hello" I would be able to get: rand == "ohlel" rand == "lleho" etc. 回答1: This solution (in a form of extension method) is nice: public static string Shuffle(this string str) { char[] array = str.ToCharArray(); Random rng = new Random(); int n = array.Length; while (n > 1) { n--; int k = rng.Next(n + 1); var value = array[k]; array[k] = array[n]; array[n] = value; } return new string(array); } 回答2: C#:

How do I call a specific Method from a Python Script in C#?

让人想犯罪 __ 提交于 2019-12-17 10:34:33
问题 I'm wondering if there is a possibility to call a specific Method from a Python script over a C# project. I have no code... but my idea is: Python Code: def SetHostInfos(Host,IP,Password): Work to do... def CalcAdd(Numb1,Numb2): Work to do... C# Code: SetHostInfos("test","0.0.0.0","PWD") result = CalcAdd(12,13) How can I call one of the Methods, from this Python script, over C#? 回答1: You can host IronPython, execute the script and access the functions defined within the script through the

Ironpython 2.6 .py -> .exe [closed]

和自甴很熟 提交于 2019-12-17 08:50:53
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 months ago . I already attempted using py2exe (not compatible with ipy) and PYC (out of date). Can anyone point me in the direction of a good compiler? 回答1: You can use pyc.py, the Python Command-Line Compiler , which is included in IronPython since version 2.6 to compile a Python script to an executable. You find it at