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
1 answer

Can you check python code in csharp before pythonNet execution?

i have recently started using pythonNet for executing scripts from Csharp, on an algorithm i was doing in csharp up until now, it works pretty well: using (Py.GIL()) { PythonEngine.Initialize(); using (var scope = Py.CreateScope()) { …
0
votes
0 answers

Why am I getting System.PlatformNotSupportedException when using SqlClient?

I'm using the current master branch of Python.Net 3.0 from GitHub, on Python 3.10, on Windows 10. I wrote a test DLL in .NET 5 that uses System.Data.SqlClient to perform a single call to a SQL Server instance as a proof-of-concept. I configured the…
downshiftdata
  • 91
  • 1
  • 1
  • 3
0
votes
1 answer

Python.NET: How to access generic member of an interface

I am trying to use a generic member from an interface in FlaUI through Python.NET. The below C# code works, // myLegacyTreeItem is a valid AutomationElement // this works and the default action expands the tree…
Amit Tendulkar
  • 178
  • 5
  • 15
0
votes
0 answers

Is it possible to add objects and functions manually to Jedi-Vim?

I created with pythonnet a interface for python to my C# project. To work in python I need auto completion for the C# import. I would write out the required objects and functions manually. But how to import these to Jedi-Vim?
Jules_96
  • 81
  • 8
0
votes
1 answer

Unable to import FlaUI.FlaUI3 library in pythonnet

I am trying to load FlaUI libraries using pythonnet. The code is able to load the FlaUI.UIA3.dll. However, importing FlaUI.UIA3 namespace fails. Here is my code, import clr import sys dll_path =…
Amit Tendulkar
  • 178
  • 5
  • 15
0
votes
1 answer

pythonnet use System.Text.Json

I am trying to utilise a .NET6 library that depends on System.Text.Json which is failing to import using pythonnet: Traceback (most recent call last): File "", line 991, in _find_and_load File "
Zander Fick
  • 106
  • 1
  • 9
0
votes
1 answer

Error: Failed building wheel for pythonnet

I am trying to install pythonnet and i can't for some reason and it just gives me this error whenever i try to install it pip3 install pythonnet Collecting pythonnet Using cached pythonnet-2.5.2.tar.gz (1.9 MB) Preparing metadata (setup.py) ...…
0
votes
0 answers

Python and .NET Core Web API two way communication

Problem: Currently, I am trying to build a demo app in which a python process is executed through API and it further invokes API Requirements: A .NET Core Web API (a) which is protected through OAuth2 scope protection invokes python process Python…
0
votes
1 answer

How to load a dll in python under Ubuntu?

I would like to import a dll file under Ubuntu 20.04 in Python 3.8. I tried it with mono and pythonnet as it was recommended in another answer: import clr clr.AddReference(dll_path) import image3dAPI but I got the following error: Invalid…
Balint
  • 43
  • 6
0
votes
1 answer

Can't build wheel and single-version-externally-managed not recognized error on pip install pythonnet WSL 2 VS Code

I am on WSL2 in VS Code. Using Zsh on VS Code. I am trying to install pythonnet though am getting two errors: ERROR: Failed building wheel for pythonnet error: option --single-version-externally-managed not recognized This is from using pip install…
JessicaRyan
  • 115
  • 3
  • 14
0
votes
2 answers

.NET methods in python (conversion from matlab code) - Delsys EMGWorks

I have a script in Matlab, which accesses a DLL and allows me to utilize the methods to import and analyse data programmatically. However, I would like to convert it to python. I have looked at using pythonnet, but I cannot get it to work. Can…
Tim
  • 133
  • 10
0
votes
1 answer

pythonnet & .net core on Linux: Cannot declare a dictionary-like object

I'm making a .net core app for Linux. The app make use of the pythonnet library to interact with python modules on the Linux box. I'm trying to do some Debian package management using the python-apt module e.g. the apt.cache class. This native…
MrCalvin
  • 1,675
  • 1
  • 19
  • 27
0
votes
0 answers

Python for .NET: passing byte[] to C# function

I'm trying to call from python code C# functions from a dll using Python for .NET. Most things worked out of the box or I could figure them out from other posts, but the last thing that refuses to work is to pass a byte[] as a parameter. Here's the…
ATR
  • 36
  • 5
0
votes
0 answers

Validation Loss and Accuracy in LSTM Networks with Pythonnet

I`m beggener in time series neural networks "LSTM" , I'm using it with pythonnet in visual studio, but I've tried a lot in training to no avail where the accuracy never increases , it's very small and loss function is nan . Is this from data or…
0
votes
1 answer

PythonNet define module from string

I'm using PythonNet to call a Python script from within a C# code. I would like to define a module in a string variable (like myModule in the code below) and to be able to import that module and use its functions later: using (Py.GIL()) { …
Starnuto di topo
  • 3,215
  • 5
  • 32
  • 66