ironpython

Loading numpy into IronPython

可紊 提交于 2019-12-06 06:19:05
I've recently installed Ironpython + tools and having trouble loading external modules (numpy). this is my test code: import numpy numpy.test() when writing my simple test, intellisense can find numpy, however when it's run from vs2010, I get: ImportException was unhandled by user code: No module named numpy IronPython Console output (shortened): numpy\__init__.py line 141 numpy\add_newdocs.py line 9 numpy\lib\__init__.py line 4 numpy\lib\type_check.py line 8 numpy\core\__init__.py line 5 ImportError: No module named multiarray the file multiarray.pyd is present in numpy\core. I have numpy

Script to Export Spotfire Graphic to PowerPoint

孤街醉人 提交于 2019-12-06 05:40:46
I am trying to export an active page to an existing PowerPoint presentation. I know how to do this from the title bar, but I would like to incorporate this into the IronPython code I am writing so I can do several slides at once. Thanks, Joseph This will open up powerpoint and export one visualisation per page: from System.IO import * from Spotfire.Dxp.Application.Visuals import VisualContent from System.Drawing import Bitmap, Graphics, Rectangle, Point import clr clr.AddReference("Microsoft.Office.Interop.PowerPoint") import Microsoft.Office.Interop.PowerPoint as PowerPoint powerpoint =

IronPython db-api 2.0

十年热恋 提交于 2019-12-06 05:17:39
Does anyone know which if any db-api 2.0 drivers work with IronPython? If so, has anyone tried using it with SQLAlchemy, SQLObject or the Django ORM? I know this is a very late answer, but I only saw the question today -- so I am answering it today. http://sourceforge.net/projects/adodbapi contains a fully compliant db-api-2 module which works with IronPython. It is restricted to use in Windows, since it uses classic ADO, using COM calls, rather than ADO.NET. [I tried a true .NET version, but it worked very poorly. The fork for it is still there if anyone wants to follow up.] A fork of this

Embedding IronPython in a C# application - import error on urllib

♀尐吖头ヾ 提交于 2019-12-06 05:09:31
问题 I have a Python file with as content: import re import urllib class A(object): def __init__(self, x): self.x = x def getVal(self): return self.x def __str__(self): return "instance of A with value '%s'" % (self.getVal()) I also have a simple C# console project with the following code: engine = Python.CreateEngine(); ScriptSource source = engine.CreateScriptSourceFromFile("test.py"); ScriptScope scope = engine.CreateScope(); ObjectOperations op = engine.Operations; source.Execute(scope); //

Python .net framework reference argument Double[]&

风流意气都作罢 提交于 2019-12-06 04:45:48
问题 Using the Python for .Net framework I'm trying to call a method from a C# .dll file. This method has the following arguments: public static void ExternalFunction( String Arg1, ref Double[]& Arg2, ); I understood the .Net framework converts Python floats to doubles. Now I would like to know how to make an array (double) and pass this as a reference to the external method. I've the following code: import clr clr.AddReference("MyDll") from MyLib import MyClass myName = "Benjamin" r = MyClass

IronPython Script debugging

…衆ロ難τιáo~ 提交于 2019-12-06 04:38:41
I have a .NET application and there is an IronPython script tab-page. Scripts work properly, but I would strongly like to have a possibility to debug them right in the application and to toggle breakpoints. Are there any solutions of this problem? You can find an IronPython debugger here and there is a series of blogs about creating it here . 来源: https://stackoverflow.com/questions/9648786/ironpython-script-debugging

Why can't I import my C# type into IronPython?

守給你的承諾、 提交于 2019-12-06 03:38:48
问题 I have some types in a C# library I wrote, e.g.: namespace SprocGenerator.Generators { public class DeleteGenerator : GeneratorBase { public DeleteGenerator(string databaseName, string tableName) : base(databaseName, tableName) I want to use them in an IronPython script: import clr import sys clr.AddReferenceToFile("SprocGenerator.dll") # problem happens here: from SprocGenerator.Generators import * generator = DeleteGenerator("a", "b") When the line below the comment happens, I get:

How to pass a lambda expression to a C# constructor from an IronPython script?

谁说胖子不能爱 提交于 2019-12-06 02:47:32
问题 I'm integrating an IronPython scritping engine into my C# raytracer which, so far, has been a breeze even though I'm completely new to Python. There is one particular thing, though, that I need help with. I have a C# class which defines a constructor like this: public CameraAnimation(Action<Camera, float> animation) In C#, I would instantiate this like so: var camAnimation = new CameraAnimation((camera, time) => camera.Position += new Vector(1, 0, 0)); I can't quite figure out how to make a

Integration of C#, F#, IronPython and IronRuby

半城伤御伤魂 提交于 2019-12-06 02:43:56
问题 I was told that the assembly files made from C# and F# source is interoperable as they are compiled into .NET assembly. Q1 : Does that mean that C# can call F# functions just like they are C# functions? Q2 : How about the IronPython and IronRuby? I don't see any assembly dll from the IronPython/IronRuby. Q3 : Is there any easy way to use IronPython/IronRuby functions from C# or F#? Any example code would be great. 回答1: 1) Yes. Using a simple example, in F#, I can invoke the main method of a C

IronPython “LookupError: unknown encoding: hex”

余生长醉 提交于 2019-12-06 01:44:43
问题 When I try to "import simplejson" (or something that depends on it) in IronPython 2.0, I get "LookupError: unknown encoding: hex". How do I make this work? 回答1: The workaround for this is to import the hex codec manually before attempting to import the broken dependency: from encodings import hex_codec The issue is being tracked by IronPython, but so far, they claim it's a bug in the standard Python library. 回答2: Thanks, sblom. I think IronPython crew are right in saying its a bug in the