Questions tagged [python.net]
Python for .NET is a package that gives Python programmers nearly seamless integration with the .NET Common Language Runtime (CLR) and Mono. Pythonnet provides a powerful application scripting tool for .NET developers. Using this package you can script .NET applications or build entire applications in Python, using .NET services and components written in any language that targets the CLR (C#, VB.NET, F#, C++/CLI) and CPython.
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 ...
asked Aug 2 '12 at 14:05
Inbar Rose
32.8k2020 gold badges7878 silver badges116116 bronze badges
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 ....
asked Jul 23 '09 at 0:06
cschol
11.6k1010 gold badges6161 silver badges7878 bronze badges
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 ...
asked Sep 9 '11 at 22:10
ychuri
51111 gold badge66 silver badges99 bronze badges
I tried pythonnet with pypy on Win10. It builds fine, but then fails to import clr. The crash happens after this call in the screenshot.
Any tips/tools for debugging this?
pypy
Python 2.7.12 (...
asked Feb 10 '17 at 5:28
denfromufa
4,92588 gold badges5656 silver badges127127 bronze badges
how can I load a c# dll in python?
Do I have to put some extra code in the c# files? (like export in c++ files)
I don't want to use IronPython. I want to import a module to Python!
asked Jan 16 '10 at 15:38
aF.
55.4k4040 gold badges123123 silver badges184184 bronze badges
I’m trying to inherit from an abstract .NET base class in Python (2.7) using Python.NET (2.1.0). I’m a Python n00b but from what I understood…
Here’s what I managed to do in Python only and which ...
asked Sep 23 '16 at 11:17
freefall
25811 silver badge1212 bronze badges
I'm using CPython and I have a C# dll. I'm trying to use Python for .NET to make them talk. I can't use IronPython because I need to integrate this into an existing CPython system.
I'm completely ...
asked Nov 6 '12 at 21:22
Annie
30511 gold badge22 silver badges66 bronze badges
I have some code written in Python which can not be transferred to a .NET language. I need to call one of these functions from my .NET WinForms application.
Now, I do it by starting the Python script ...
asked Jul 8 '11 at 12:35
Tom
3,4432020 gold badges6868 silver badges127127 bronze badges
I downloaded Python for .NET.
Inside the zip is clr.pyd, nPython.exe, Python.Runtime.dll and 2 debug database files.
I put the clr.pyd and Python.Runtime.dll in my python DLLs dir C:\Python27\DLLs ...
asked Jan 31 '13 at 19:33
user441521
5,8221616 gold badges7171 silver badges136136 bronze badges
I've been able to use the standard Python modules from IronPython, but I haven't gotten SciPy to work yet. Has anyone been able to use SciPy from IronPython? What did you have to do to make it work?
...
asked Feb 22 '09 at 8:57
John D. Cook
27.6k1010 gold badges6262 silver badges9393 bronze badges
I'm starting to study Python, and for now I like it very much. But, if you could just answer a few questions for me, which have been troubling me, and I can't find any definite answers to them:
What ...
How can we export C# methods?
I have a dll and I want to use its methods in the Python language with the ctypes module.
Because I need to use the ctypes module, I need to export the C# methods for ...
asked Jan 17 '10 at 18:49
aF.
55.4k4040 gold badges123123 silver badges184184 bronze badges
I have the following problem:
I got an old application which is written in python. This application allows the user to specify small python steps which will be executed, python steps are basically ...
asked Apr 17 '14 at 9:12
Xeun
77611 gold badge88 silver badges1919 bronze badges
I have a python library I am trying to use via IronPython (v2.7 RC1 [2.7.0.30]) invocation from C# application. The library uses NumPy and SciPy quite extensively, which does work with SciPy and NumPy ...
I was learning python using the tutorial that comes with the standard python installation. One of the benefits that the author states about python is "maybe you’ve written a program that could use an ...
asked Apr 30 '09 at 19:43
Developer
14.5k2525 gold badges6161 silver badges8888 bronze badges
Now I'm developing C# app running on Windows.
Some of processes are written in Python, that called via pythonnet (Python for .NET).
The processes are calculation-heavy, so I want to do them in ...
asked Dec 26 '17 at 11:44
I do understand that this topic has been covered in some way at StackOverflow but I'm still not able to figure out the exact answer: can I treat IronPython as a Pythonic replacement to C#?
I use ...
asked Apr 11 '10 at 12:38
Ewan Doe
20511 silver badge88 bronze badges
Edit: This will be fixed in a new version of pythonnet (when this pull request is merged).
I have a problem with Python.NET inheritance. I have a DLL which consists of the following code:
using ...
I am new to IronPython. Thanks for you help and patience.
I installed IronPython 2.7 from http://ironpython.net/ in Visual Studio 2015.
I also installed Python 2.7.6 and anaconda.
I tried the ...
asked Sep 20 '16 at 13:21
Hikaru
12111 gold badge11 silver badge33 bronze badges
I've been trying to save plots(multiple) from different scripts using an interactive C# process command.
Objective: My aim is to save plots by executing multiple scripts in a single interactive ...
asked Sep 9 '16 at 6:36
Ramkumar
44011 gold badge44 silver badges2121 bronze badges
Am trying to integrate python code in my .net core application for data analysis and some machine learning classification. How can I do this the best way?
Note: I don't want to execute scripts with ...
asked Aug 23 '18 at 20:51
ak2492
22311 gold badge33 silver badges1111 bronze badges
I have found old answer to this question but instruction provided in the mentioned post is no longer working... Essentially the URL where NumPy for IronPython was stored is broken.
How to install ...
asked Jun 22 '17 at 23:29
So I'd like to take advantage of Brotli but I am not familiar with Python and C++..
I know someone had compiled it into a Windows .exe. But how do I wrap it into a DLL or something that a .NET app ...
asked Jan 29 '16 at 1:42
gt6707a
54911 gold badge66 silver badges1212 bronze badges
Can we load a pandas DataFrame in .NET space using iron python? If not I am thinking of converting pandas df into a csv file and then reading in .net space.
asked Jan 21 '13 at 3:21
Alok
2,76833 gold badges2121 silver badges4646 bronze badges
Am trying to use clr.AddReference and clr.AddReferenceToFile to import an assembly, but python(2.7) keeps making this error:
Traceback (most recent call last):
File "<pyshell#5>", line 1, in ...
asked Dec 20 '17 at 19:26
Ran
45522 gold badges88 silver badges1616 bronze badges
I am using Windows 7, 64-bit. I have managed to download and install pythonnet, so
import clr
clr.AddReference("System.Windows.Forms")
from System.Windows.Forms import Form
works fine. I have also ...
asked Jun 13 '11 at 16:07
Petter
30.9k66 gold badges4040 silver badges5858 bronze badges
I am trying to execute a Python script that uses Python For .Net (https://github.com/pythonnet/pythonnet) to load a C# library called "Kratos_3.dll" which is in the same folder as the script but the ...
asked Mar 3 '15 at 20:00
baconwichsand
98511 gold badge1111 silver badges3030 bronze badges
I'm currently looking at python because I really like the text parsing capabilities and the nltk library, but traditionally I am a .Net/C# programmer. I don't think IronPython is an integration point ...
asked Nov 24 '09 at 4:21
Trent
1,78211 gold badge2121 silver badges3636 bronze badges
I am trying to embed python 2.6 in .NET 4.0.
Following the very minimal documentation in "Python for .NET", I wrote a fairly straightforward code as follows:
const string pythonModulePath = @"C:\...
asked Jan 17 '11 at 11:34
Is it possible to productionize Python code in a .NET/C# environment without installing Python and without converting the Python code to C#, i.e. just deploy the code as is?
I know installing the ...
asked Jun 24 '19 at 20:31
FatihAkici
3,35311 gold badge1717 silver badges3838 bronze badges
I have some python code that does a certain task. I need to call this code from C# without converting the python file as an .exe, since the whole application is built on C#.
How can I do this?
asked Apr 8 '11 at 6:58
Raj
44222 gold badges66 silver badges2020 bronze badges
I am writing a Python wrapper class for a C# API accessed through Pythonnet.
As I want to extend the API with my own methods I decided to wrap it using the composition approach outlined here:
The C# ...
asked Apr 12 '16 at 18:08
Olaf
28122 silver badges99 bronze badges
I have a handfull of .dll files with classes designed to control an external device connected to my desktop via ethernet. I'd like to import these classes to python and use their member functions / ...
asked Mar 19 '12 at 13:53
I'm writing C++ code which should invoke python scripts underneath.
For this purpose I use cpython of python.org.
Some of the python scripts execute .net code with help of python for .net and when it ...
asked Oct 31 '14 at 18:58
y_d
6111 gold badge11 silver badge33 bronze badges
There is a way to use NumPy/SciPy in IronPython, using IronClad to execute/communicate with the CPython binaries of the same. A newer project, Python Tools for VS allows for a faster integration with ....
asked Oct 18 '12 at 6:02
TheFlash
94.6k128128 gold badges361361 silver badges572572 bronze badges
I have been given a library written in C# that I'm trying to call using Python for .NET.
The primary class I need an instance of has a constructor like:
GDhuClient(IGDhuSettings)
There are no (...
I've developed a dll in visual studio that I'd now like to use in Python using the standard IDLE.
I cannot seem to find a straightforward solution to this anywhere. I've tried using pip install *dll ...
asked Dec 14 '15 at 12:02
Stinkidog
31611 gold badge44 silver badges1717 bronze badges
I'm using Python.NET to load a C# Assembly to call C# code from Python. This works pretty cleanly, however I am having an issue calling a method that looks like this:
A method within Our.Namespace....
asked Nov 4 '14 at 18:54
skulz00
63977 silver badges1616 bronze badges
I've been played with Python.Net for a week, but I can't find any sample code to use Python.Net in embedded way although Python.Net source has several embeddeding tests. I've searched many threads ...
asked Apr 1 '13 at 18:15
spark
29744 silver badges1515 bronze badges
After loading a reference to an assembly with something like:
import clr
clr.AddRferenceToFileAndPath(r'C:\foo.dll')
How can I unload the assembly again?
Why would anyone ever want to do this? ...
asked Sep 1 '09 at 12:03
Daren Thomas
58.6k3838 gold badges139139 silver badges187187 bronze badges
I have a .cs file like
namespace SomeNamepace
{
public struct SomeStruct
{
....
}
public static class SomeClass
{
....
}
So far I use it with PythonNET ...
asked Apr 20 '18 at 13:13
Joe
4,64322 gold badges1010 silver badges3131 bronze badges
I'm mainly working in Spyder, building scripts that required a pop-up folder or file Browse window.
The code below works perfect in spyder.
In Pycharm, the askopenfilename working well, while ...
asked Apr 12 '18 at 12:01
I'm try to load pythonnet runtime dll from scriptcs and it does not work with roslyn backend because dynamic is not supported in Roslyn, but mono backend chokes with the following error:
$ scriptcs -...
asked Sep 9 '15 at 5:44
denfromufa
4,92588 gold badges5656 silver badges127127 bronze badges
I want to get low level access to webcam properties using DirectShow's IAMVideoProcAmp.
There are several Python modules )pywin32, pywintypes, comtypes, win32com, pythoncom) that are used in this ...
asked Aug 14 '18 at 14:11
Joe
4,64322 gold badges1010 silver badges3131 bronze badges
I have a problem loading an external dll using Python through Python for .NET. I have tried different methodologis following stackoverflow and similar. I will try to summarize the situation and to ...
I have a Python script which receives data from a .NET application. How do I use an incoming buffer of type 'System.Collections.Generic.List`1[System.Byte]' in my script?
The function of the script ...
I am almost at the end of my wits here and am hoping you all could help me figure this one out. I am running Anaconda Python 3.5 64 bit and compiled Python.NET anaconda package to add .NET ...
asked Jun 21 '17 at 23:19