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.

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.

https://pythonnet.github.io/

578 questions
0
votes
0 answers

OleDB in Pythonnet and Mono on Mac OS X

I am trying to run several method of a dll library that I own. I use pythonnet 3.0.0dev, python3.9 and Mono 6.10.0. One of the methods triggers creating an .mdb file. On a windows machine I've install Microsoft Access Database Engine (suggested by…
kasra545
  • 37
  • 2
  • 7
0
votes
0 answers

Using Pythonnet, how to handle output in C#?

Here is the code of Python: import trendln import yfinance as yf # requires yfinance - pip install yfinance tick = yf.Ticker('^GSPC') # S&P500 hist = tick.history(period="max", rounding=True) h = hist[-1000:].Close mins, maxs =…
Jaffer Wilson
  • 7,029
  • 10
  • 62
  • 139
0
votes
1 answer

Converting a .NET type (System.Converter) to a Python type with Python.NET

I am trying to write the Python.NET equivalent of this C# code: Util.ArrayInit(motifPositionData[i], j => backgroundDist.Sample()); However, the Util.ArrayInit() method accepts an int and a Converter Delegate --- of which I have no…
Christabella Irwanto
  • 1,161
  • 11
  • 15
0
votes
0 answers

I want to implement interaction with .Net variables in python code.Is there any way to replace scope.Set() scope.Get() of pythonnet?

There may be multiple writes and reads to variables in a python runtime.Like: # int myint=1 a=NetCore.Get(myint) b=a+2 NetCore.Set(myint,b) # myint=3 a=NetCore.Get(myint) c=a+1 NetCore.Set(myint,c) # return myint=4 Thank you!
CSayHi
  • 1
0
votes
1 answer

How to change the python version in a .net project?

I need to use Tensorflow.net and Keras.net nuget packages for my project, but I have an error. Unable to load DLL 'python38' or one of its dependencies. I managed to remove this error by adding the python38.dll file to the bin folder. But I would…
0
votes
1 answer

Calling a .Net function form python which takes an argument (passed by reference)

I am trying to invoke a .Net function from python using the Python.net module. The existing code was written on Iron Python, I am in the process of converting the code base to Python 3.X version. Can somebody please help me with this? I am currently…
0
votes
1 answer

Python 3: How to create an instance of an abstract class from a .net DLL (Pythonnet), (to satisfy the signature of overloaded methods)

I need to call a method from an DLL with pythonnet. This methods expects a list of a specific type to fill in the returned objects. After some research I found the hint that I need only a dummy (to satisfy the…
Matze
  • 23
  • 3
0
votes
1 answer

Python.net is not receiving correct encoded string from .net

I am using .net 4.7.1 console program talking to python.net that VS2017 is reporting as version 2.5.1.0 (runtime version v4.0.30319) Python code is in 3.6 python: def ping(input): if (input == 'ping'): return 'pong' return…
0
votes
1 answer

Import Error When Attempting To Import C# Code Into Python Script

I have little to no experience with C# but I'm attempting to import a C# class into a python script for a project I'm working on but I constantly run into a pylint(import-error). Originally, I thought that the issue was due to compiling .Net Core…
0
votes
1 answer

python.net construct WPF window with custom controls

I'm trying to use python.net and WPF to have a modern look & feel on my app. I also want to use the FluentWPF library to give it the MS Fluent style. I built the FluentWPF project and loaded the dll in python.net and built a simple window XAML to…
G.Vernier
  • 369
  • 2
  • 14
0
votes
0 answers

Python.Net not resolving Microsoft.Data.SqlClient

I'm trying to load Microsoft.Data.SqlClient using Python.net. I have unpacked the dll into at directory like this: assembly_path = r"C:\Users\mike\Projects\Python\pythonnet\microsoft.data.sqlclient.2.0.0\lib\netstandard2.0\Microsoft.Data.SqlClient"…
MikeAinOz
  • 126
  • 1
  • 10
  • 24
0
votes
1 answer

Issue with cx_freeze and pythonnet clr

I am attempting to build an application using pythonnet clr and cx_freeze, I have successfully built it with pyinstaller so I know it works but when using cx_freeze I and try to launch the .exe is receive the following error: Unhandled Exception:…
David sherriff
  • 466
  • 1
  • 3
  • 9
0
votes
1 answer

Pythonnet in jython

I am trying to execute class and functions written in python from java via jython. It runs fine until in python we encountered "import clr" which is pythonnet. Can anyone tell how to run the python scripts from java using jython or any thing else…
0
votes
1 answer

How to import .Net Classes in Python using Python.Net

I'm using Python.NET to create wrapper for iText.net (https://github.com/itext/itext7-dotnet). The dll is named itext.kernel.dll and the python script is in the samne folder of all the itext dlls. With Jetbrain dotPeek I see that itext.kernel has…
VeryStrange
  • 61
  • 1
  • 5
0
votes
0 answers

How to use EmguCV on Ubuntu 18.04?

I am trying to use EmguCV with Python, but failed. Here are the things I have done and tried: Python version: 3.6.9 pip version: 20.1.1 I have installed the requirements of pythonnet: pytest==3.2.5 coverage psutil pycparser mono Then installed…
Nyakui
  • 1
  • 1