Questions tagged [ironpython]

IronPython is an open-source implementation of the Python programming language which is tightly integrated with the .NET Framework. IronPython can use the .NET Framework and Python libraries, and other .NET languages can use Python code just as easily. Use this tag for implementation-specific questions, general Python questions should just be tagged with "python".

IronPython is an open-source implementation of the Python programming language which is tightly integrated with the .NET Framework. IronPython can use the .NET Framework and Python libraries, and other .NET languages can use Python code just as easily.

IronPython can be obtained at http://ironpython.net/.

Comparison of IronPython vs. C# for 'Hello World'

c#:

using System;
class Hello
{
    static void Main() 
    {
        Console.WriteLine("Hello, World");
    }
}

IronPython:

print "Hello, World"

IronPython is a Dynamic Language that runs on the .NET DLR (Dynamic Language Runtime) in contrast with VB.NET and C# which are static languages.

Iron Python can also import DLL files compiled in other languages and use functions defined therein. For example:

import clr
clr.AddReference("System.Windows.Forms")
from System.Windows.Forms import *

Chat/Communication

Join our Gitter-Chat under: https://gitter.im/IronLanguages/main

2618 questions
770
votes
18 answers

Find and Replace Inside a Text File from a Bash Command

What's the simplest way to do a find and replace for a given input string, say abc, and replace with another string, say XYZ in file /tmp/file.txt? I am writting an app and using IronPython to execute commands through SSH — but I don't know Unix…
Ash
  • 24,276
  • 34
  • 107
  • 152
197
votes
9 answers

How do I run a Python script from C#?

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__': with open(sys.argv[1],…
Inbar Rose
  • 41,843
  • 24
  • 85
  • 131
93
votes
10 answers

IronPython vs. Python .NET

I want to access some .NET assemblies written in C# from Python code. A little research showed I have two choices: IronPython with .NET interface capability/support built-in Python with the Python .NET package What are the trade-offs between both…
cschol
  • 12,799
  • 11
  • 66
  • 80
66
votes
3 answers

How can I call (Iron)Python code from a C# app?

Is there a way to call Python code, using IronPython I assume, from C#? If so, how?
David Thielen
  • 28,723
  • 34
  • 119
  • 193
59
votes
5 answers

Calling a C# library from python

Anyone can share a working example on how to call a simple C# library (actually its WPF) from python code? (I have tried using IronPython and had too much trouble with unsupported CPython library my python code is using so I thought of trying the…
ychuri
  • 661
  • 1
  • 8
  • 9
52
votes
4 answers

Django on IronPython

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…
Xian
  • 76,121
  • 12
  • 43
  • 49
50
votes
12 answers

Powershell window disappears before I can read the error message

When I call a Powershell script, how can I keep the called script from closing its command window. I'm getting an error and I'm sure I can fix it if I could just read the error. I have a Powershell script that sends an email with attachment using…
jadero
  • 720
  • 1
  • 5
  • 9
49
votes
1 answer

Ambigious reference for ExtensionAttribute when using Iron Python in Asp.Net

I get the following error when starting an Asp.Net site that uses an assembly that in turn makes use of the dlr and Iron Python for scripting. BC30560: 'ExtensionAttribute' is ambiguous in the namespace 'System.Runtime.CompilerServices'. The issue…
Patrik Hägne
  • 16,751
  • 5
  • 52
  • 60
46
votes
3 answers

How to control the "Updating skeletons" background task in PyCharm for IronPython interpreter?

Is there a way to suppress, stop or, otherwise, control the settings for, or display of, background tasks in PyCharm? Selecting the IronPython interpreter causes it to update skeletons (seemingly) every time the interpreter is selected and usually…
Bill Craun
  • 865
  • 1
  • 7
  • 13
44
votes
4 answers

Instantiating a python class in C#

I've written a class in python that I want to wrap into a .net assembly via IronPython and instantiate in a C# application. I've migrated the class to IronPython, created a library assembly and referenced it. Now, how do I actually get an instance…
Yes - that Jake.
  • 16,725
  • 14
  • 70
  • 96
44
votes
3 answers

Slicing a dictionary by keys that start with a certain string

This is pretty simple but I'd love a pretty, pythonic way of doing it. Basically, given a dictionary, return the subdictionary that contains only those keys that start with a certain string. » d = {'Apple': 1, 'Banana': 9, 'Carrot': 6, 'Baboon': 3,…
Aphex
  • 7,390
  • 5
  • 33
  • 54
44
votes
3 answers

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

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…
Tolga E
  • 12,188
  • 15
  • 49
  • 61
41
votes
1 answer

What is the difference between Python vs Jython vs IronPython vs wxPython?

I am quite new in Python programming. While googling I found some of the Python related words. I just wanted to know what is the difference among Python, Jython, IronPython, and wxPython. I know wxPython is for GUI programming. But what are Jython…
Rasmi Ranjan Nayak
  • 11,510
  • 29
  • 82
  • 122
36
votes
5 answers

F# vs IronPython: When is one preferred to the other?

While the languages F# and IronPython are technically dissimilar, there is large overlap between their potential uses in my opinion. When is one more applicable than the other? So far it look to me like F# is computationally more efficient while…
Muhammad Alkarouri
  • 23,884
  • 19
  • 66
  • 101
35
votes
4 answers

Can you use LINQ types and extension methods in IronPython?

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?
tarn
  • 2,192
  • 2
  • 13
  • 17
1
2 3
99 100