[Python.NET] Locking Issues

Haran Shivanan shivanan at statictype.org
Wed Aug 16 13:52:22 CEST 2006


Hi,

I've got some code in C# that embeds python as an interpreter using 
Python.NET.
This code executes various python scripts to calculate values and 
returns. I'm calling AcquireLock() and ReleaseLock() before and after 
each use of the PythonEngine. The code works flawlessly in a WinForms 
test app. But if I try to run the code from an ASP.NET web application 
or a web service, sometimes, the call to AcquireLock waits 
indefinitiely. Stepping through a debugger shows that first time I call 
it, it works, and then ReleaseLock() also works. But then a second call 
to AcquireLock hangs. This problem is only there if I execute the code 
from a web application.
Is this a known issue?
Is there any work-around for it?

If its a bug in the Python.NET code, then maybe I can look at possibly 
fixing it.
Or could it be a fundamental problem with the Python interpreter itself?

Thanks,
Haran


More information about the PythonDotNet mailing list