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
1
vote
0 answers

Why is IronPython sys.path not consistent with regular Python?

According to https://docs.python.org/2/library/sys.html#sys.path the first item in sys.path should be the directory of the script that was originally called by the interpreter. I created a simple script that prints out the information contained in…
Waters
  • 343
  • 1
  • 11
1
vote
0 answers

Ironpython not able to calculate md5check sum for large size files

import hashlib with open("file5GB.bin" , 'rb') as fd: md5 = hashlib.md5() while True: data = fd.read(2**20) if not data: break md5.update(data) md5_local = md5.hexdigest() print md5_local results…
1
vote
0 answers

How do I remove an IronPython event from a C# event handler from WITHIN the event?

As an extension of this question: How do I create a C# event handler that can be handled in IronPython? My IronPython script looks like this: def BarHandler(*args): Foo.Bar -= BarHandler Foo.Bar += BarHandler There are no errors, but…
Omboam
  • 11
  • 2
1
vote
1 answer

Does anyone know where to find Enthought NumPy binaries for IronPython?

A couple of years ago, Enthought decided to undertake the herculean task of rebuilding NumPy to work well with IronPython. Working binaries were hosted at the following location for a while: https://store.enthought.com/repo/.iron/ However, since the…
glopes
  • 4,038
  • 3
  • 26
  • 29
1
vote
1 answer

No performance improvement when compiling code in IronPython

I have the problem, that in some cases the Execute method for an ScriptSource takes a long time. This is problematic, because i use this method very often for the same ScriptSources. Now i tried to compile ScriptSource and save the result object.…
BendEg
  • 20,098
  • 17
  • 57
  • 131
1
vote
2 answers

How to make *.py files have the python icon in Win7?

Installed the IronPython tools for VS 2010 but it didn't associate the *.py files to VS, neither did it (obviously) change the *.py files' icon. How do I do that in Windows 7?
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
1
vote
3 answers

Build .NET DLLs from Python code?

How do I make a DLL (.NET) written in python code (IronPython)?
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
1
vote
1 answer

How do I deal with C# decimals when using IronPython?

I'm new to IronPython and Python in general. I'm trying to work with C# decimals and IronPython math functions. When I try to return the absolute value of an argument, I get a type exception when the argument is a decimal. Here's my code: …
user2023861
  • 8,030
  • 9
  • 57
  • 86
1
vote
1 answer

Why does IronPython str() of a string object raise a UnicodeEncodeError?

Our web app utilizes custom made IronPython scripts (the IronPython version is 2.7.3) An object in the script is converted to string at one point. It is definitely a string. It is provided by our app and its value has come from an outer system. The…
Срба
  • 463
  • 3
  • 17
1
vote
1 answer

How do I import a third-party IronPython module in .NET?

I am C# developer and I have to use an IronPython library in the .NET framework. I tested every class in Python and it's working but I am not sure how to call the library in a C# class. When I try to call the library, I am getting a 'LightException'…
nikunjM
  • 560
  • 1
  • 7
  • 21
1
vote
0 answers

Reading piped stdin with IronPython

I have a Python script "test1.py" with the following contents: import sys for line in sys.stdin: print line When I call the script like this type some_file.txt | ipy test1.py All lines of "some_file.txt" are printed to the console (as…
Krid
  • 95
  • 1
  • 11
1
vote
1 answer

Ironpython issue with import hook subpackage/submodule

I have been struggling with something that I now think may be a bug in IronPython. If anyone could confirm this suspicion or set me straight I would be grateful. The issue I am facing is when trying to apply import hooks using sys.meta_path or…
macsec
  • 11
  • 4
1
vote
1 answer

How do I escape spaces for subprocess?

I'm trying to use IronPython 2.7 with the subprocess module to run WMIC with output going to a temporary directory. However, I'm having very strange problems with escaping the spaces. fn=r'C:\"Documents and Settings"\me\"Local…
gbronner
  • 1,907
  • 24
  • 39
1
vote
0 answers

Cannot get IronPython Console in PyDev to resolve System.String methods

I'm using IronPython 2.7 within PyDev 4.0.0.2x in Eclipse Luna Service Release 2 (4.4.2). The editor's Autocompletion can 'see' the IsNullOrEmpty method in System.String library, but the Console cannot (opened against IronPython OR the current…
lcorrigan
  • 11
  • 3
1
vote
2 answers

Python integer unexpected results

I am using IronPython 2.7 integrated into Rhinoceros 5 application. I am having a strange int() function result: import math angle = 45.0 tangent = math.tan(math.radians(angle)) n = 12*tangent print "angle: ", angle print "tangent: ", tangent print…
marco
  • 899
  • 5
  • 13
  • 21
1 2 3
99
100