ironpython

How to load an excel file in IronPython?

How to load an excel file in IronPython? Question: I am trying to load an excel file within an IronPython script, which is embedded within a software. I tried to do this with the following code: import clr clr.AddReference("Microsoft.Office.Interop.Excel") import Microsoft.Office.Interop.Excel as Excel excel = Excel.ApplicationClass() excel.Visible = True workbook = excel.Workbooks.Open("C:UsersantoiDesktoprimo_reportae-project-reportingcodes_02_heat_recoverydataunit_data_simp_08.xlsx") However, I get …

Total answers: 1

Python CLR Winforms – Passing data between .NET Winforms

Python CLR Winforms – Passing data between .NET Winforms Question: I have a fairly simple task that has eluded me when using Python to generate and automate .NET WinForms. How do I pass data between forms? I’ve tried everything: using global variables, using immutable strings, etc. and nothing seems to stick. Can someone show me …

Total answers: 1

IronPython error under .Net Core: "failed to parse CPython sys:version"

IronPython error under .Net Core: "failed to parse CPython sys:version" Question: I have a .Net 4.x WPF desktop solution that uses IronPython to run numerous scripts in the form of .py files. I’ve just finished migrating the solution to .Net 6, but I see this error when the software tries to run a particular script: …

Total answers: 2

Playing audio in jupyter, in a for loop

Playing audio in jupyter, in a for loop Question: I have a ton of training data I need annotated, in order to do so I need to listen through a bunch of sound snippets and note what I hear. I wrote a small script for this in a notebook. My main issue is that IPython …

Total answers: 2

Visual Studio – "The environment IronPython|2.7-32 appears to be incorrectly configured or missing"

Visual Studio – "The environment IronPython|2.7-32 appears to be incorrectly configured or missing" Question: Steps to the Reproduce: Open Visual Studio 2017 (Pro on Windows 10 64-bit) File > New Project > IronPython Application Run the default program: print(‘Hello world’) When I run it, I get the following error: The environment “IronPython|2.7-32” appears to be …

Total answers: 4

Python to C# StongBox[Single]

Python to C# StongBox[Single] Question: I’ve used IronPython to add a reference to a C# dll. I’m attempting to use a method in the DLL which requires an argument of type: out float tempValue When I pass a python float object to the method I get the following traceback: Traceback (most recent call last): File …

Total answers: 2

Terminating an IronPython script

Terminating an IronPython script Question: This may not specifically be an IronPython question, so a Python dev out there might be able to assist. I want to run python scripts in my .Net desktop app using IronPython, and would like to give users the ability to forcibly terminate a script. Here’s my test script (I’m …

Total answers: 2

Problems embedding IronPython in C# (Missing Compiler required member 'Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember'

Problems embedding IronPython in C# (Missing Compiler required member 'Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember' Question: I’m trying to do a simple hello world to test out embedding IronPython within C# but can’t seem to resolve this problem.. This is my C# file; using System; using IronPython.Hosting; using Microsoft.Scripting; using Microsoft.Scripting.Hosting; using System.IO; public class dynamic_demo { static void Main() …

Total answers: 3

How do I run a Python script from C#?

How do I run a Python script from C#? Question: This sort of question has been asked before in varying degrees, but I feel it has not been answered in a concise way and so I ask it again. I want to run a script in Python. Let’s say it’s this: if __name__ == ‘__main__’: …

Total answers: 9

Writing python on mac to use on Windows

Writing python on mac to use on Windows Question: I’ve seen from some sources that although you can make an exe or mac equivalent app using py2exe or py2app, you can only make the one your system is. Makes sense when I think about it. But my problem is sometimes I want to write python …

Total answers: 2