ironpython

Export Datatables from Spotfire to CSV using IronPython Script

北城余情 提交于 2019-12-06 13:01:28
问题 I have a IronPython script I use to export all my data tables from a Spotfire project. Currently it works perfectly. It loops through all datatables and exports them as ".xlsx". Now I need to export the files as ".csv" which I thought would be as simple as changing ".xlsx" to ".csv". This script still exports the files, names them all .csv, but what is inside the file is a .xlsx, Im not sure how or why. The code is just changing the file extension name but not converting the file to csv. Here

Hosted IronPython: import files which contain custom functions

情到浓时终转凉″ 提交于 2019-12-06 12:42:49
Situation Hosted IronPython allows developers to set parameters into script. Every time when a IPy engine object is created, I set such a parameter (ParamName), but when I try to import python module, in which my custom parameter is used, I get an exception with message "global name 'ParamName' is not defined". Code sample class PythonScriptingEngine { private ScriptEngine pyEngine; private ScriptScope pyScope; public PythonScriptingEngine() { pyEngine = Python.CreateEngine(); pyScope = pyEngine.CreateScope(); } public object Run(string script) { ScriptSource source = pyEngine

Error when creating an IronPython project in VisualStudio; “Exception has been thrown by the target of an invocation.”

徘徊边缘 提交于 2019-12-06 10:10:23
I have a solution which will have a GUI built in on C# and I want to create a IronPython project in the solution which will be called from the C# code but I can't even create it. I'm using the python tools from CodePlex and IronPython 2.7 Edit: This is I found in the ActivityLog.xml System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Failed to load language 'IronPython 2.7.2.1': Method not found: '!!1[] Microsoft.Scripting.Utils.ArrayUtils.ConvertAll(!!0[], System.Func 2<!!0,!!1>)'. ---> System

It's possible to use requests in ironpython 2.7.5?

房东的猫 提交于 2019-12-06 09:52:28
I've successful installed pip on ironpython. But when i try to install requests with "ipy.exe -X:Frames -m pip install requests" in a administrator console I get the following: ------------------------------------------------------------ C:\Program Files (x86)\IronPython 2.7\lib\site-packages\pip\__main__.py run on 02/02/16 16:13:53 Downloading/unpacking html5lib Getting page https://pypi.python.org/simple/html5lib/ Cleaning up... Removing temporary dir c:\users\panta\appdata\local\temp\pip_build_panta... Exception: Traceback (most recent call last): File "C:\Program Files (x86)\IronPython 2.7

Get last statement result in embedded IronPython v2

ぐ巨炮叔叔 提交于 2019-12-06 09:33:00
This post in Mike Stall's blog states that The last expression result is stored as the global variable "_" , so you can retrieve it like so: object o = m_python.GetVariable("_"); But currently in v2 scope has no such variable after executing, e.g., scriptEngine.CreateScriptSourceFromString("a=1+2;a+1", SourceCodeKind.Statements); Is there any way to access result (a+1) without explicitly define variable? I suspect with IronPython 2 you need to use SourceCodeKind.Interactive. I'll try it out later and see if this works. 来源: https://stackoverflow.com/questions/1966421/get-last-statement-result

How can I get generics to work in Python.NET with CPython

做~自己de王妃 提交于 2019-12-06 08:51:54
How can I get generics to work in Python.NET with CPython. I get an error when using the subscript syntax from Python.NET Using Generics TypeError: unsubscriptable object With Python 2.7.11 + pythonnet==2.1.0.dev1 >python.exe Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import clr >>> from System import EventHandler >>> from System import EventArgs >>> EventHandler[EventArgs] Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError:

IronPython, Click Once, .NET 2.0 Error - thoughts?

蹲街弑〆低调 提交于 2019-12-06 07:42:23
I'm am trying to roll out a test application to test the feasibility of righting a Click Once Smart Client app that also uses a rules engine customizable by embedding IronPython. So far all users but me get this error (below) when invoking the script engine. Do I need to do something special to force deployment of the IronPython and Scripting assemblies? I thought that would be automatic because they were referenced in my project. Is this just not feasible in .NET 2.0? Thoughts? ************** Exception Text ************** System.MissingMethodException: Method not found: 'Void System

Is there any way to debug Python code embedded in C# with Visual Studio and PTVS?

六眼飞鱼酱① 提交于 2019-12-06 07:39:26
问题 I've created the code to embed IronPython code in C# public ScriptEngine GetEngine() { if( _engine != null ) return _engine; _engine = Python.CreateEngine(); var paths = _engine.GetSearchPaths(); paths.Add( _pythonPath ); _engine.SetSearchPaths( paths ); var runtime = _engine.Runtime; runtime.LoadAssembly( typeof( CharacterCore ).Assembly ); return _engine; } public IAbility Movement() { var engine = GetEngine(); var script = engine.CreateScriptSourceFromFile( Path.Combine( _pythonPath,

How to add reference to a dynamic assembly for compiling another dynamic assembly?

别说谁变了你拦得住时间么 提交于 2019-12-06 07:29:57
In my AppDomain there are few dynamic assembly, when I try codeDom.CompileAssemblyFromSource to Compile another new assembly, I can't figure out a way to add those dynamic assemble to ReferencedAssemblies. foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { compilerParameters.ReferencedAssemblies.Add(assembly.Location); } Failed, as dynamic assembly doesn't have Location. Thanks in advance. PS: I'm actually trying to use ASP.Net MVC 3's new Razor template engine in IronPython. Not test, try use assembly.FullName instead of assembly.Location . tenkod I was having similar issue

IronPython & WPF: Binding a checkbox's IsChecked property to a class member variable

旧巷老猫 提交于 2019-12-06 06:28:55
问题 I've seen many similar questions on how to get data binding working with a checkbox, but all of the examples I've seen are in C# and I can't seem to make the leap to convert it to IronPython. I have a checkbox defined in a window thusly: <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="Test" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup