ironpython

How can I use –X:Frames in Ironpython?

人盡茶涼 提交于 2019-11-30 15:37:42
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. Dave IronPython Tools for Visual Studio has been deprecated by Python Tools for Visual Studio (see http://pytools.codeplex.com ). Using Python Tools in VS 2010: open Tools

Can't use DateTime in IronPython

[亡魂溺海] 提交于 2019-11-30 13:51:53
I'm hosting my IronPython in a C# webapp like so: var engine = Python.CreateEngine(); var scope = engine.CreateScope(); var script = Engine.CreateScriptSourceFromString(pythonCode, SourceCodeKind.Statements); script.Execute(scope); And my python code looks like this: import clr clr.AddReference('System.Core') from System import DateTime theDate = DateTime.Today() Which generates this error: IronPython.Runtime.Exceptions.ImportException: Cannot import name DateTime I've spent some time on Google and most of the code I found doesn't seem to work anymore. My IronPython Runtime Version is v2.0

Python decorators that are part of a base class cannot be used to decorate member functions in inherited classes

老子叫甜甜 提交于 2019-11-30 12:48:13
问题 Python decorators are fun to use, but I appear to have hit a wall due to the way arguments are passed to decorators. Here I have a decorator defined as part of a base class (the decorator will access class members hence it will require the self parameter). class SubSystem(object): def UpdateGUI(self, fun): #function decorator def wrapper(*args): self.updateGUIField(*args) return fun(*args) return wrapper def updateGUIField(self, name, value): if name in self.gui: if type(self.gui[name]) ==

Build Python scripts and call methods from C#

守給你的承諾、 提交于 2019-11-30 11:28:38
问题 Is there any way to make this scenario work? There is a Python script. It is built into a DLL by running this script with IronPython: import clr clr.CompileModules("CompiledScript.dll", "script.py") The goal is to call this DLL's methods from C# code. .NET Reflector shows there is one class in the DLL - DLRCashedCode and the methods we are interested in are private static methods of this class. For example, there is a function in the script: def scriptMethod(self, text): ... Its

Extending C# .NET application - build a custom scripting language or not?

余生长醉 提交于 2019-11-30 08:43:28
I need to build a scripting interface for my C# program that does system level testing of embedded firmware. My application contains libraries to fully interact with the devices. There are separate libraries for initiating actions, getting output and tracking success/failure. My application also has a GUI for managing multiple devices and assigning many scripts to be run. For the testers (non-programmers, but technical), I need to provide a scripting interface that will allow them to come up with different scenarios for testing and run them. They are just going to call my APIs and then return

can you typecast a .NET object in IronPython?

喜夏-厌秋 提交于 2019-11-30 05:17:23
问题 I'm interfacing with a .NET API in IronPython. The API is returning an object of the wrong type (some kind of generic object). I suspect that the problem is not showing up in their C# code because the type declaration when the object is constructed is forcing the returned object to the correct type. Is it possible to typecast an .NET object in IronPython? I think this would do the trick. 回答1: To force a conversion you can do: import clr convertedObject = clr.Convert(someObject, someType) This

Why is IronPython faster than the Official Python Interpreter

我的梦境 提交于 2019-11-30 05:03:45
According to this: http://www.codeplex.com/IronPython/Wiki/View.aspx?title=IP20VsCPy25Perf&referringTitle=IronPython%20Performance IronPython (Python for .Net) is faster than regular Python (cPython) on the same machine. Why is this? I would think compiled C code would always be faster than the equivalent CLI bytecode. Python code doesn't get compiled to C, Python itself is written in C and interprets Python bytecode. CIL gets compiled to machine code, which is why you see better performance when using IronPython. You're right, C is a lot faster. That's why in those results CPython is twice as

Empty list is equal to None or not? [duplicate]

ぃ、小莉子 提交于 2019-11-30 03:59:22
Possible Duplicate: Why does “[] == False” evaluate to False when “if not []” succeeds? I am new to python as per ternary operator of python >>> 'true' if True else 'false' true true i am expecting for below code output as [] because [] not equal to None >>> a=[] >>> a==None False >>> a if a else None None pleas correct if i am wrong Thanks hema The empty list, [] , is not equal to None . However, it can evaluate to False --that is to say, its "truthiness" value is False . (See the sources in the comments left on the OP.) Because of this, >>> [] == False False >>> if []: ... print "true!" ...

Can i use all standard Python libraries with IronPython or

人盡茶涼 提交于 2019-11-30 03:19:10
问题 ... does it requires some sort of wrappers? I was under expression that IronPython is a .NET implementation of the Python which somehow magically enables applications built with IronPython to use standard Python libraries (which I believe either a raw .py sources or .py source packaged into the eggs), but when I was reading http://www.doughellmann.com/PyMOTW/hashlib/index.html at the bottom of the page I spotted: "A wrapper for hashlib that works with IronPython." which immediately put me on

Writing an Iron Python debugger

不问归期 提交于 2019-11-30 03:14:54
问题 As a learning exercise I'm writing myself a simple extension / plugin / macro framework using IronPython - I've gotten the basics working but I'd like to add some basic debugging support to make my script editor easier to work with. I've been hunting around on the internet a bit and I've found a couple of good resources on writing managed debuggers (including Mike Stall's excellent .Net Debugging blog and the MSDN documentaiton on the CLR Debugging API) - I understand that IronPython is