[Tutor] cgi.FieldStorage() causing thread.error: can't allocate lock
Peter Otten
__peter__ at web.de
Fri May 23 18:33:30 CEST 2014
Alan Gauld wrote:
> On 23/05/14 12:57, SABARWAL, SHAL wrote:
>> Wondering if anyone came across this error in using form =
>> cgi.FieldStorage()
>>
>> import tempfile
>>
>> File /tempfile.py", line 83, in <module> _once_lock
>> = _allocate_lock()
>>
>> thread.error: can't allocate lock
>>
>> puthon version 2.7, on HP-UX 11.11
>
> Since we can't see the code in tempfile.py we could ony guess
> Also please include the full error traceback, that looks like
> you have summarised it.
>
> 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?
More information about the Tutor
mailing list