ironpython

IronPython “LookupError: unknown encoding: hex”

匿名 (未验证) 提交于 2019-12-03 03:09:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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 standard library (or at least Freeze tool as of 2.7)

Simplfying DSL written for a C# app with IronPython

孤者浪人 提交于 2019-12-03 02:59:17
Thanks to suggestions from a previous question , I'm busy trying out IronPython, IronRuby and Boo to create a DSL for my C# app. Step one is IronPython, due to the larger user and knowledge base. If I can get something to work well here, I can just stop. Here is my problem: I want my IronPython script to have access to the functions in a class called Lib. Right now I can add the assembly to the IronPython runtime and import the class by executing the statement in the scope I created: // load 'ScriptLib' assembly Assembly libraryAssembly = Assembly.LoadFile(libraryPath); _runtime.LoadAssembly

Why the Common Language Runtime Cannot Support Java [closed]

依然范特西╮ 提交于 2019-12-03 02:54:20
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Today the Common Language Run Time Supports Many Languages including Iron Python and Iron Ruby. We can similarly can use J Ruby and J Python in Java Run Time environments . If so why the .net frame work common language run time cannot support for Java? Um

BeautifulSoup and ASP.NET/C#

≯℡__Kan透↙ 提交于 2019-12-03 02:52:50
Has anyone integrated BeautifulSoup with ASP.NET/C# (possibly using IronPython or otherwise)? Is there a BeautifulSoup alternative or a port that works nicely with ASP.NET/C# The intent of planning to use the library is to extract readable text from any random URL. Thanks Colin Pickard Html Agility Pack is a similar project, but for C# and .NET EDIT: To extract all readable text: document.DocumentNode.InnerText Note that this will return the text content of <script> tags. To fix that, you can remove all of the <script> tags, like this: foreach(var script in doc.DocumentNode.Descendants("script

IronPython in Unity3D

匿名 (未验证) 提交于 2019-12-03 02:46:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to use IronPython as an external scripting language for Unity3D. The necessary DLLs for IronPython's execution load just fine inside of Assets\Plugins. However, when I try to run the script I get this error: PythonImportErrorException: No module named UnityEngine IronPython.Modules.Builtin.__import__ (IronPython.Runtime.Calls.ICallerContext,string,object,object,object) <IL 0x0003b, 0x001cc> (wrapper dynamic-method) object.__import__##5 (IronPython.Runtime.Calls.ICallerContext,object,object,object,object) <IL 0x0000e, 0x0004d>

Calling IronPython object from C# with mono

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have the following IronPython code. class Hello: def __init__(self): pass def add(self, x, y): return (x+y) I need to call this from C#, and I came up with the following code. using System; using IronPython.Hosting; using IronPython.Runtime; using IronPython; using Microsoft.Scripting.Hosting; using Microsoft.Scripting; class Hello { public static void Main() { ScriptEngine engine = Python.CreateEngine(); ScriptSource script = engine.CreateScriptFromSourceFile("myPythonScript.py"); ScriptScope scope = engine.CreateScope(); script.Execute

IronPython on ASP.NET MVC

可紊 提交于 2019-12-03 02:21:52
问题 Has anyone tried ASP.NET MVC using IronPython? Having done a lot of Python development recently, it would be nice to continue with the language as I go into a potential ASP.NET MVC project. I'm especially interested in exploiting the dynamic aspects of Python with .NET features such as LINQ and want to know if this will be possible. The other route that may be viable for certain dynamic programming would be C# 4.0 with its dynamic keyword. Thoughts, experiences? 回答1: Yes, there is an MVC

Django on IronPython

匿名 (未验证) 提交于 2019-12-03 01:58:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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 problem which discusses the absence of zlib for

Can you use LINQ types and extension methods in IronPython?

拈花ヽ惹草 提交于 2019-12-03 01:39:56
问题 Is it possible to use the LINQ types and extension methods in IronPython? If so how? And also is there often more pythonic to do the same thing? 回答1: IronPython 2.7 finally bridges this gap with the clr.ImportExtensions method which adds the extension methods from a namespace to the target types e.g. >& 'C:\Program Files\IronPython 2.7\ipy.exe' IronPython 2.7 (2.7.0.40) on .NET 4.0.30319.225 Type "help", "copyright", "credits" or "license" for more information. >>> import clr >>> clr

How to use IronPython with App.Config?

限于喜欢 提交于 2019-12-03 01:29:13
I have a class library that is usually called from a .net console or web application. It integrates with various components, and relies on an app.config or web.config. If I want to utilise the class library from script (i.e. IronPython), how can I get the script to utilise the config file? Ideally I want to be able to choose the config file when I run the script, or by convention (config file sitting alongside the script file). I don't want to change the ipy.exe.config if possible as this wouldn't scale for multiple configurations without having multiple copies of IronPython? Any alternatives?