ironpython

Iron python, beautiful soup, win32 app

爷,独闯天下 提交于 2019-11-28 03:16:33
Does beautiful soup work with iron python? If so with which version of iron python? How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)? I was asking myself this same question and after struggling to follow advice here and elsewhere to get IronPython and BeautifulSoup to play nicely with my existing code I decided to go looking for an alternative native .NET solution. BeautifulSoup is a wonderful bit of code and at first it didn't look like there was anything comparable available for .NET, but then I found the

IronPython: EXE compiled using pyc.py cannot import module “os”

泪湿孤枕 提交于 2019-11-28 03:04:49
I have a simple IronPython script: # Foo.py import os def main(): print( "Hello" ) if "__main__" == __name__: main() It runs fine and prints Hello if I run it with IronPython as: ipy Foo.py Following the instructions given in IronPython - how to compile exe , I compiled this IronPython script to a EXE using: ipy pyc.py /main:Foo.py /target:exe Executing Foo.exe gives this error: Unhandled Exception: IronPython.Runtime.Exceptions.ImportException: No module named os at Microsoft.Scripting.Runtime.LightExceptions.CheckAndThrow(Object value) at DLRCachedCode.__main__$1(CodeContext $globalContext,

Assigning an IronPython method to a C# delegate

做~自己de王妃 提交于 2019-11-28 01:12:04
问题 I have a C# class that looks a little like: public class MyClass { private Func<IDataCource, object> processMethod = (ds) => { //default method for the class } public Func<IDataCource, object> ProcessMethod { get{ return processMethod; } set{ processMethod = value; } } /* Other details elided */ } And I have an IronPython script that gets run in the application that looks like from MyApp import myObj #instance of MyClass def OtherMethod(ds): if ds.Data.Length > 0 : quot = sum(ds.Data.Real)

How to create a data table on the fly in Spotfire via python

主宰稳场 提交于 2019-11-28 00:58:23
问题 I need to iterate each row, add items to a dictionary, do some sorting and then spit out the results into a data table I need to create on the fly via script. http://spotfirecommunity.tibco.com/community/blogs/tips/archive/2011/03/06/displaying-cross-table-data-as-a-new-data-table.aspx I can't access this article any more, does anyone have the code to do something similar to this at all? Thanks 回答1: Worked it out with some help. You have to create a .Net DataSet and DataTable, add rows in

Can scikit be used from IronPython?

可紊 提交于 2019-11-28 00:26:25
I saw that numpy can be used from IronPython : https://www.enthought.com/repo/.iron/ Is it possible to install and import scikit in IronPython? Im trying to interface between a module written in python 2.7 with scikit and an external COM object with IronPython... Thanks IronPython is certainly not supported by scikit-learn, and I doubt that it'll work without significant effort. The NumPy and SciPy for IronPython document describes the porting effort required for SciPy, and this has certainly not been done for scikit-learn, which too depends heavily on Cython-generated C code (unless someone

What is the equivalent of the C# “using” block in IronPython?

大兔子大兔子 提交于 2019-11-27 22:53:18
What's the equivalent of this in IronPython? Is it just a try-finally block? using (var something = new ClassThatImplementsIDisposable()) { // stuff happens here } IronPython supports using IDisposable with with statement, so you can write something like this: with ClassThatImplementsIDisposable() as something: pass Reed Copsey IronPython (as of the 2.6 release candidates) supports the with statement, which wraps an IDisposable object in a manner similar to using. With statement . For example: with open("/temp/abc") as f: lines = f.readlines() There is the with statement: http://www

How to use Microsoft.Scripting.Hosting?

落爺英雄遲暮 提交于 2019-11-27 21:48:35
问题 To embed some IronPython Code into C# I want to use the ScriptEngine using IronPython.Hosting; using Microsoft.Scripting.Hosting; I found the reference for IronPython, but where is the necessary reference for Scripting.Hosting? I can't find it within VisualStudio 2008, targeting .Net 3.5. 回答1: It looks like this is part of the DLR binaries ... more information here: https://blogs.msdn.com/seshadripv/archive/2008/06/24/how-to-write-a-simple-dlr-host-in-c-using-hosting-api.aspx 回答2: The DLR is

What's the simplest way to access mssql with python or ironpython?

不打扰是莪最后的温柔 提交于 2019-11-27 18:01:45
I've got mssql 2005 running on my personal computer with a database I'd like to run some python scripts on. I'm looking for a way to do some really simple access on the data. I'd like to run some select statements, process the data and maybe have python save a text file with the results. Unfortunately, even though I know a bit about python and a bit about databases, it's very difficult for me to tell, just from reading, if a library does what I want. Ideally, I'd like something that works for other versions of mssql, is free of charge and licensed to allow commercial use, is simple to use, and

Integration of python in C# Application

牧云@^-^@ 提交于 2019-11-27 17:59:51
问题 I have the following problem: I got an old application which is written in python. This application allows the user to specify small python steps which will be executed, python steps are basically small python scripts, I call them steps because the execution of this application involves other steps like executing something from commandline. These python steps are stored as python code in an xml file. Now I want to rewrite the application by using C# .NET. Is there a best practise solution to

Embedding IronPython in C#

佐手、 提交于 2019-11-27 14:09:13
I am just looking into using IronPython with C# and cannot seem to find any great documentation for what I need. Basically I am trying to call methods from a .py file into a C# program. I have the following which opens the module: var ipy = Python.CreateRuntime(); var test = ipy.UseFile("C:\\Users\\ktrg317\\Desktop\\Test.py"); But, I am unsure from here how to get access to the method inside there. The example I have seen uses the dynamic keyword, however, at work I am only on C# 3.0. Thanks. See embedding on the Voidspace site. An example there, The IronPython Calculator and the Evaluator