ironpython

Natural language parser for dates (.NET)?

孤人 提交于 2019-12-03 07:38:23
I want to be able to let users enter dates (including recurring dates) using natural language (eg "next friday", "every weekday"). Much like the examples at http://todoist.com/Help/timeInsert I found this post , but it's a bit old and offered only one solution that I'm not entirely content with. I thought I'd resurrect this question and see: are there any other .NET libraries out there that do this kind of date parsing? I know it's not an optimal solution but you can also try to port the dateJs library to .net It handles things like today; tomorrow; July 2008; next friday; last April; 2004.08

What are some strategies to write python code that works in CPython, Jython and IronPython

一曲冷凌霜 提交于 2019-12-03 07:12:19
问题 Having tries to target two of these environments at the same time I can safely say the if you have to use a database etc. you end up having to write unique code for that environment. Have you got a great way to handle this situation? 回答1: If you do find you need to write unique code for an environment, use pythons import mymodule_jython as mymodule import mymodule_cpython as mymodule have this stuff in a simple module (''module_importer''?) and write your code like this: from module_importer

Is it possible to host the .Net DLR in an “idiot-proof” sandbox?

和自甴很熟 提交于 2019-12-03 06:49:52
I would like to host the Dynamic Language Runtime (DLR) in such a way that users who run arbitrary scripts in it cannot bring the process down? The DLR hosting spec describes how to host the DLR in a separate ApplicationDomain. This allows to tear down and unload a script runtime and to restrict certain operations through CAS (e.g. I can restrict file system access or disallow use of reflection). But are there also ways to for example: - restrict the maximum amount of memory used by a script? - restrict the number of threads created by a script? - detect deadlocked scripts? I think such fine

Run a particular Python function in C# with IronPython

不羁岁月 提交于 2019-12-03 06:22:45
问题 So far I have a simple class that wraps a python engine (IronPython) for my use. Although code looks big it's really simple so I copy it here to be more clear with my issue. Here's the code: public class PythonInstance { ScriptEngine engine; ScriptScope scope; ScriptSource source; public PythonInstance() { engine = Python.CreateEngine(); scope = engine.CreateScope(); } public void LoadCode(string code) { source = engine.CreateScriptSourceFromString(code, Microsoft.Scripting.SourceCodeKind

Sandbox IronPython?

情到浓时终转凉″ 提交于 2019-12-03 06:10:12
问题 Is it possible to run an IronPython interpreter inside my .Net application, but inside a sandbox? I want to deny the IP script access to the filesystem while still allowing the app itself access. Would this involve running the scripting engine in a second AppDomain? How would I handcuff it so it can't do whatever it pleases? 回答1: Here's an article explaining how to create an AppDomain and execute code in a sandbox. Just create the AppDomain and handcuff the code that runs inside it. 来源: https

How do you implement an interface in IronPython?

送分小仙女□ 提交于 2019-12-03 06:09:34
The FAQ that comes with IronPython 2.0.1 says the following: You can define interfaces in C#, build those into a DLL, and then implement those interfaces in Python code as well as pass the python objects that implement the interfaces to C# code. I have googled and googled and googled, but haven't found how to do this. Can someone help? I'm not sure of this, but it looks like you could do it with the regular inheritance syntax of python: class SomeClass (ISomeInterface): def SomeMethod(self, parameter): pass EDIT: Ok, I just tested it and confirmed that you can implement an interface in

IronPython in Unity3D

泪湿孤枕 提交于 2019-12-03 05:43:50
问题 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

BOO Vs IronPython

跟風遠走 提交于 2019-12-03 05:10:38
What is the difference between IronPython and BOO ? Is there a need for 2 Python-like languages? IronPython is designed to be a faithful implementation of Python on the .NET platform. Version 1 targets Python 2.4 for compatibility, and version 2 targets version 2.5 (although most of the Python standard library modules implemented in C aren't supported). Boo 's stated aim is to be a "wrist-friendly [dynamic] language for the CLI." It takes a lot of inspiration from Python, but diverges on four main points: It's designed specifically to take good advantage of the .NET platform The designer

Iron Python : what are good uses for Iron Python [closed]

吃可爱长大的小学妹 提交于 2019-12-03 04:28:58
Closed . This question needs to be more focused. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it focuses on one problem only by editing this post . I have an affinity for python, but I work in a .NET environment, so I was looking into Iron Python, and wondering what it would be used for. Could you write an app in it? or is it for adding a scripting language to your app? How do you guys use it? Either or both :) I wouldn't claim to know a specific "purpose" for IronPython but it certainly can be used to write applications, and it can

NLTK in IronPython from WPF

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 03:40:25
I would like to use NLTK (Natural Language Toolkit) for Python using IronPython and call from an exisiting WPF/c# project. Is it possible to reference NLTK from within WPF in this way. For example to use Named Entity Recognition from NTLK? Any advice or guidance appreciated. It definitely is possible, as long as NLTK doesn't use any C extensions. It will be much easier if you use VS2010 though, because of the dynamic keyword. Look at the Microsoft.Scripting.Hosting library from IronPython, it will get you started towards loading the NLTK code and executing methods on it. 来源: https:/