Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 18:11

    filmor on master

    disallow runtime shutdown when … (compare)

  • 18:11
    filmor closed #1780
  • 18:10
    filmor commented #1780
  • 17:34
    lostmsu commented #1780
  • 17:34
    lostmsu commented #1780
  • 17:34
    lostmsu commented #1780
  • 17:29
    lostmsu closed #1782
  • 17:29
    lostmsu commented #1782
  • 13:17
    filmor locked #699
  • 13:17
    filmor commented #699
  • 12:01
    OliverLai commented #699
  • 10:45
    OliverLai commented #699
  • 10:35
    OliverLai commented #699
  • 07:38

    filmor on fix-enum-codec

    (compare)

  • 07:38

    filmor on master

    Fix enum codec A boxed enum va… Add unit test for enum encoder Allow conversion of UInt64 base… and 1 more (compare)

  • 07:38
    filmor closed #1621
  • 06:41
    filmor commented #1621
  • 06:40
    filmor synchronize #1621
  • 06:40

    filmor on fix-enum-codec

    Add unit test for enum encoder Allow conversion of UInt64 base… (compare)

  • 06:33
    filmor synchronize #1621
anna_jingwen
@anna_jingwen:matrix.org
[m]
what I have done is the following:
and it gave me error like this:
scottyi
@scottyi:matrix.org
[m]
Hi Guys, can anyone help me explain why this happens? I tried to call azure.storage.files.datalake .net library from a python program with pytonnet (2.5.2), but I always got the following error: from Azure.Storage.Files.DataLake import DataLakeFileSystemClient
ModuleNotFoundError: No module named 'Azure.Storage.Files'; 'Azure.Storage' is not a package
the code is like this:

import clr
import sys

assembly_path = r"C:\Users\xxx\dlls"
sys.path.append(assembly_path)

clr.AddReference("Azure.Core")
clr.AddReference("Azure.Storage.Blobs")
clr.AddReference("Azure.Storage.Common")
clr.AddReference("Azure.Storage.Files.DataLake")

from Azure.Storage import StorageSharedKeyCredential
from Azure.Storage.Files.DataLake import DataLakeFileSystemClient
from Azure.Storage.Files.DataLake import DataLakeServiceClient

Ghost
@ghost~615dab646da0373984875144
Does it work to export the PyScope and import it before I run my python file which depends on that scope? (for saving time)
Hyeonsoo Moon
@mhyeonsoo
Hi guys, has anyone tried to install pythonnet in unity project?
1 reply
lahr-ul
@lahr-ul
Hi everyone, I have the following Signature in my C# Class: public bool GetPictureData(string strChannel, int objectID, out int width, out int height, out int[] imagePixels). In Python I try to use it like this: my_obj.GetPictureData('c01', 0, Int32(0), Int32(0), Array[int](0)) but I get TypeError: Cannot convert 0 to System.Int32[]. What am I doing wrong?
jdunne525
@jdunne525

I get a "invalid syntax" error when I try to set a checkbox on a WinForms checkbox from Python. Here is the line I'm executing:
Host.LogToResultsCheckBox.Checked = True

The same line works fine from C#.
Does anyone know how to access a form property like that? I can read the property's state just fine from Python. I just can't write to it.

fodangithub
@fodangithub
@jdunne525 I believe its due to "boxing" process. check the document at http://pythonnet.github.io/ under its "Type Convertion" section theres some explanations
jdunne525
@jdunne525
@fodangithub Thank you! I ended up doing the following and it worked:
checkbox = Host.LogToResultsCheckBox.Checked; checkbox = True; Host.LogToResultsCheckBox.Checked = checkbox
1 reply
Anderu123
@Anderu123
image.png
1 reply
Does anyone have any idea? Before compiling into .pyd, no error at all. After compiling, even tho reference being added, error still occurred. Appreciate if there is any answer to this issue
This issue occurred when .py calling .pyd with clr.AddReference. However if .py calling .py with clr.AddReference there was no issue at all...
guytaylor
@guytaylor
Is it possible to create a python type from C#? I am trying to replicate some C++ code which uses PyTypeObject and PyModule_AddObject but can't figure out if it's even possible in c#. Thanks
Andres Quintero
@a.quintero_gitlab
Hi, I have a question, im doing some stuff with python 3.10.2 and the only functional option so far is the prerelease version, is there any plans to release that version soon or there is any planned date? thanks in advance :)
DarthMazut
@DarthMazut
Hello! Could someone help me to setup python in .NET 5 for osX? Is anyone here?
jdunne525
@jdunne525
People are here, but you need to ask a direct question with a straightforward answer. It doesn't look like any of the developers are paying much attention to this.
DarthMazut
@DarthMazut
So my problem is that, when I assign value to PythonEngine.PythonPath the application crashes on MacOS (no exception caugh despite try...catch block). I use Avalonia 10.12 and .NET 5. I assign this value @"/Users/kasperczyks/Desktop/PyCommon", I have folder on my desktop on macOS (Catalina 10.15.7) from where I want to import stuff. It works on windows, but I cannot make it run on MacOS. So should I use PythonEngine.PythonPathor rather Environment.SetEnvironmentVariable? I tried the second option multiple times but notnigh seems to work for my case
Puneet Jain
@teenup96
I am getting this error
Unhandled exception. System.DllNotFoundException: Unable to load DLL 'python38' or one of its dependencies: The specified module could not be found. (0x8007007E)
at Python.Runtime.Runtime.Py_IsInitialized()
at Python.Runtime.Runtime.Initialize(Boolean initSigs)
at Python.Runtime.PythonEngine.Initialize(IEnumerable1 args, Boolean setSysArgv, Boolean initSigs) at Python.Runtime.PythonEngine.Initialize(Boolean setSysArgv, Boolean initSigs) at Python.Runtime.PythonEngine.Initialize() at Numpy.np.InstallAndImport(Boolean force) at Numpy.np.<>c.<.cctor>b__614_0() at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.CreateValue()
at System.Lazy`1.get_Value()
at Numpy.np.get_self()
at Numpy.np.arrayT
at ML.Net.Program.Main() in C:\Users\P129626\learning\ML.Net\Program.cs:line 12
1 reply

When I am using

var data = Numpy.np.array(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 });

        Console.WriteLine(data);
Any suggestion would work
SherenL
@SherenL

Hi, I am getting this error. Please could anyone offer some advice? it would be much appreciated,

I use Python 3.9.5 and VS Code 2021.

Main errors seems to be:

C:\Users\A.nuget\packages\microsoft.build.tasks.git\1.0.0\build\Microsoft.Build.Tasks.Git.targets(24,5): error : Error reading git repository information: Unsupported repository version 1. Only versions up to 0 are supported. [C:\Users\A\AppData\Local\Temp\pip-req-build-f0p8hkr5\src\runtime\Python.Runtime.csproj]

C:\Users\A.nuget\packages\microsoft.build.tasks.git\1.0.0\build\Microsoft.Build.Tasks.Git.targets(24,5): warning : Unable to locate repository with working directory that contains directory C:\Users\A\AppData\Local\Temp\pip-req-build-f0p8hkr5\src\runtime. [C:\Users\A\AppData\Local\Temp\pip-req-build-f0p8hkr5\src\runtime\Python.Runtime.csproj]
hcholm
@hcholm
image.png
This will print both lines and then hang. Killing the process takes a few seconds. Any ideas? .NET 6, Win10, pythonnet 3.0.0-preview2022-03-03.
hcholm
@hcholm
same with python38.dll btw
AtlantisDe
@AtlantisDe
https://github.com/pythonnet/pythonnet/discussions/1733 Failed to load file or assembly 'XXXXXXX' Many such errors.. who knows why, thanks a lot
Coegmen
@Coegmen
Hi guys. I'm new to pythonnet, but I need to call a company DLL from my Python code for compliance purposes. Our AppSec guys told me I had to get off of Python 3.8.6 due to vulnerabilities. We're going forward with 3.9.10, but PyPi doesn't have a pythonnet-2.5.2-cp39-cp39-win_amd64.whl, so pip install fails on 3.9. Any idea when a semi-stable 3.9 version of pythonnet will be available? Is it even something the developers are working on in 2.5.2, or do I have to wait for 3.0.0 to be released?
Daniel Hrisca
@danielhrisca
Hello all, I'm facing a problem were pythonnet 2.5.2 works on a PC but version 3.0.0 gives this error pythonnet\__init__.py", line 44, in load RuntimeError: Failed to initialize Python.Runtime.dll
1 reply
.net 4.5 is installed on the PC (Windows 10 x64 Evergreen 21H1)
Python 3.10 x64
any ideas what might be wrong?
jealy06
@jealy06
image.png
jealy06
@jealy06
Hi so I am trying to run a csharp file that I built using the dotnet command that references other dlls from a python script. I have been at this for days now trying to figure out how to run this. I thought the problem could be pythonnet wasnt supported with python 3.9 so I created a virtual environment and using pyton 3.8.8 and it still isnt working. The name space in my c sharp file is Payment_Application and I have all the dll files in the same folder that the dll I am referencing above in my path is. I have a rudimentary understanding of c sharp but enough to understand clr and the .net framework. I am running .net 6.0. Could it be I am not using .net core?
dwguardian
@dwguardian:matrix.org
[m]
Hello community. I have just been introduced to Python.NET and have a use case question. I am moving a large number of complex forms from a VB.NET designer which produces XML (Specifically the GetCode function of the BasicHostLoader) into DJANGO web-based forms. I need to retain the ability for my users to create new forms or adjust old ones (altering the XML). Does Python.NET offer me a way to bridge that gap? My target functionality is for changes made in the VB.NET designer to be reflected in DJANGO views, but could work with any steps forward.
Sergio
@SergioMate
Hello all, I'm trying to make some test using pythonnet but isinstance asserts with MagicMocks of NET classes do not work as spected.
I'm using mock_instance = MagicMock(spec=NetClass) based on mock doc but isinstance(mock_instance, NetClass) returns False.
Any idea what I may be doing wrong? Is there any kind of workaround?
ATHUL D S
@athulds

Hi all, Facing an issue after migrated from 2.5.2 to 3.x pre release versions . Basically the python int type is getting translated to PyInt inside my .net DLL and getting and error -- this is happening when I pass my python int as a value in a .net dictionary. this was working earlier in 2.5.2 version where the int was getting converted to System.int32

System.InvalidCastException: Unable to cast object of type 'Python.Runtime.PyInt' to type 'System.IConvertible'.
at System.Convert.ToInt32(Object value)
at ImageOCR.TemplateElement..ctor(Dictionary`2 paramDict)

Any one faced similar issue ?

1 reply
ksrangarajan
@ksrangarajan
Let us know minimum version of .NET FRamework required for https://github.com/pythonnet/pythonnet/releases/tag/v3.0.0-a2?
1 reply
VectorASD
@VectorASD
Hi!
The type initializer for 'Delegates' threw an exception.
What does it mean?
1 reply
Heringsfischer
@Heringsfischer
Hello,
I have a .NET dll that I want to use in my Python project. One function returns a Matrix as a .NET object. If I print the variable in Python it returns INT32[,]. In .NET I can get the data with a cast like this ((int32[,])Matrix). How can I do that in Python with Pythonnet?
Best regards
Jonathan Fraser
@JonathanFraser
So I'm creating a python extension for an existing application. The extension loads correct, and I can execute python code. I can call back into the CLR for things like System and Debug but whenever I try to add reference and import back into the CLR for application code all I get is empty COM objects.
Mason Bially
@mason-bially
I'm having trouble using python objects without leaking memory.
var baz = myModule.getNumber() as PyObject;
baz.As<int>(); // put this in a for loop and watch the memory explode
AtlantisDe
@AtlantisDe

hello how can i new an C# Class in the py code ? like

        /// <summary>UserItem</summary>
        public class UserItem
        {
            /// <summary>Name</summary>
            public string Name { get; set; }
            /// <summary>Age</summary>
            public int Age { get; set; }
        }

i want use it in Python Code like

                using (var scope = Python.Runtime.Py.CreateScope())
                {
                    //how import the class ?
                    var code = "from ???.types import UserItem";

                    var code = "userItem =  UserItem()";
                    scope.Exec(code);

                }

thanks ... pls give me the think...idea...