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

pythonnet in linux cannot import ssl

i'm trying to run python scripts from .net using pythonnet in ubuntu (wsl). but when import ssl, I got the following error Python.Runtime.PythonException: ModuleNotFoundError : No module named '_ssl' File "/usr/local/lib/python3.8/ssl.py", line…
0
votes
3 answers

Pythonnet: cannot access to dll class

I'm having issues trying to load a Dll's class made in c# with pythonnet Here's the dll project config (VS) Here's the class code using System; namespace ClassLibrary1 { public class Class1{ public void test() { …
0
votes
1 answer

Convert Bytes[] to Python Bytes Using PythonNet

I have a PythonNet C# bytes[] object and I need to convert it to Python's bytes. Is there a way to do this using Python? Here is what I'm doing to get the bytes. I need to go into the winstore's credential store and export out a client…
JabberJabber
  • 341
  • 2
  • 17
0
votes
0 answers

Opening an Interactive Python Shell instance within a Windows Form Application using PythonNet

As the title says, I'm wanting to initiate an interactive shell instance for python within a Windows Form application. .NET Runtime: .NET Framework 4.7.2 Python Version: 3.8.10 PythonNet Version: 3.0 Here is my C# Code: using System; using…
0
votes
1 answer

Why can I access this API from IronPython but not Python.NET?

I’m working on a project that uses the Tekla EPM Open API. I have no difficulty interfacing with it using IronPython, but have had less luck using Python.NET, which I would prefer for its greater compatibility with other modules. The API…
0
votes
0 answers

List all methods in a DLL along with the type of argument it accepts and value returned

Can any one please let me know how to load a DLL in Python and list all methods in it along with the type of argument it accepts and its return value type?
Programmer
  • 8,303
  • 23
  • 78
  • 162
0
votes
1 answer

Two way communication between .NET and Python

My main application is a .NET desktop application which relies on some calls to python script for AI. I'd like to know if there are some guidelines/recommandations toward how to best have my python code able to use functions from my .net app. Shall…
Amaury Levé
  • 1,459
  • 10
  • 21
0
votes
1 answer

Deploying a pre-built embedded Python environment on Windows

I'm looking at setting up a completely self-contained Python environment which will get carried (or downloaded) by my .NET app installer. This Python environment will be used via pythonnet to execute Python code from a .NET app context. The…
Vlad
  • 1,889
  • 17
  • 33
0
votes
1 answer

Python.NET & TensorFlow & CUDA: Could not load dynamic library 'cublas64_11.dll'

I am current working on using Python.NET to build C# environments for interaction TensorFlow Agents and am receiving a TensorFlow error attempting to load Cuda DLLs. When I run pure python examples Tensor flow loads the CUDA DLLs without…
Alexander Higgins
  • 6,765
  • 1
  • 23
  • 41
0
votes
2 answers

Convert Python floating-point into C# decimal

I'm trying to convert a floating-point number in Python into decimal in C# using pythonnet. Let's say there is one number 0.0234337688540165776476565071. I have tried this in two ways: using float() from System import…
6991httam
  • 305
  • 4
  • 14
0
votes
1 answer

What docker image should I pull to be able to install pyodbc and pythonnet?

I'm trying to dockerize an application that has previously deployed on windows and I was wondering what python image I should use in order to resolve an issue with installing pyodbc and pythonnet. My requirements: pyodbc==4.0.25 pythonnet==2.4.0 the…
Boris
  • 716
  • 1
  • 4
  • 25
0
votes
0 answers

call C# dll file from python

my C# file Calculator.c using System; namespace DynamicCS { public class Calculator { public double add(double argA, double argB) { return argA + argB; } public double sub(double…
0
votes
1 answer

Unittest mock a .NET with pythonnet

Is there a way to mock a .NET library loaded with clr.AddReference(), without the presence of the actual dll? My code: import clr clr.AddReference("lib/MyDeviceDriver") import MyDeviceDriver class MyClass: def __init__(self): …
0
votes
1 answer

A console window opens alongside, each time I run my windows form application written in pythonnet. Can't find a way to turn that off

I'm building a windows forms application using pythonnet. I've built a pretty basic app, code below!, I used pyinstaller to turn it into an exe. But every time I run the exe file, a console window opens alongside the gui app. I can't find a way to…
abaid
  • 31
  • 6
0
votes
1 answer

Python.Net distribution with my application: online or offline install?

I’m looking for some advice about the best way to distribute Python.Net with my application. It seems that I have two options: 1. My application installer runs pip install pythonnet The downside is that the customer needs to have internet access at…
Vince
  • 25
  • 6