[Tutor] cgi.FieldStorage() causing thread.error: can't allocate lock
Dave Angel
davea at davea.name
Sun May 25 00:03:49 CEST 2014
Peter Otten <__peter__ at web.de> Wrote in message:
> Alan Gauld wrote:
>
>>
>> As it stands it is impossible to tell how tempfile.py relates to
>> cgi.FieldStorage() or even if the error is related to that
>> at all.
>
> Here's what the cgi.FieldStorage.make_file() method looks like
>
> def make_file(self, binary=None):
> # docstring omitted
> import tempfile
> return tempfile.TemporaryFile("w+b")
>
> and importing from within a method is generally a bad idea when threads are
> involved. However, I'm unable to provoke the error the OP is seeing.
>
> Shal, does the error occur every time or sporadically? Can you provide code
> to reproduce the error?
>
If indeed that's the problem, the solution could be as easy as
doing another import of that module BEFORE starting threads.
--
DaveA
More information about the Tutor
mailing list