An error in threading.py?

Robert Kern robert.kern at gmail.com
Wed Mar 11 18:27:34 EDT 2009


On 2009-03-11 17:15, Oltmans wrote:
> Hi, all. I'm trying to use Mechanize in a multithreaded program--
> purpose of which is to fill out a form on a website using concurrent
> threads. Guys, trust me I've spent a lot of time to figure out the
> problem but I'm completed puzzled. Firstly, I've listed the errors and
> then the program listing (with imports omitted)

Why omit the imports?

> Error:
>
> Traceback (most recent call last):
>    File "C:\Python25\lib\threading.py", line 460, in __bootstrap
>      self.run()
>    File "tmechanize.py", line 21, in run
>      with lock:
> NameError: global name 'lock' is not defined

The problem is in tmechanize.py, not threading.py. You forgot to actually make 
the lock object.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list