-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error #291
Comments
I changed the C# code and the problem was solved private async Task Test((string fileName, (string name, string desription, string type, string version)) item)
{
try
{
using (GIL.Acquire())
{
var fileName = Path.GetFileNameWithoutExtension(item.fileName);
using PyObject module = Import.ImportModule(fileName);
using var infoFunc = module.GetAttr("test");
var testStr = "Hello, World!";
using var pyStr = PyObject.From(testStr);
using var result = infoFunc.Call(pyStr);
var info = result.As<string>();
if (info != testStr)
{
throw new Exception("Test failed");
}
}
}
catch (Exception ex)
{
await jsRuntime.InvokeVoidAsync("alert", ex.Message);
logger.LogError(ex, "Test failed");
return;
}
await jsRuntime.InvokeVoidAsync("alert", "Test passed");
} |
I think your problem was the
However, the
On point 2, I think the exception here is CSnakes/src/CSnakes.Runtime/Python/Import.cs Lines 7 to 10 in 586bb13
and neither does CSnakes/src/CSnakes.Runtime/CPython/Import.cs Lines 13 to 19 in 048e011
@tonybaloney can probably comment on whether |
Thank you! I understand what it is. But unfortunately, I wanted to use it in a multitasking app. |
Right, but do you need the GIL for that? Couldn't you use a standard lock or synchronisation primitive to coordinate the work between the threads in your application? |
Error in calling python method from Blazor app:
Python file:
C# code:
The text was updated successfully, but these errors were encountered: