lmco / laikaboss

Laika BOSS: Object Scanning System
Apache License 2.0
739 stars 156 forks source link

NameError: global name 'answer' is not defined #60

Open nbareil opened 7 years ago

nbareil commented 7 years ago

Hello,

There is an undefined variable in the exception handler when open() fails in laika.py:

Traceback (most recent call last):
  File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/local/lib/python2.7/dist-packages/laikaboss-2.0-py2.7.egg/EGG-INFO/scripts/laika.py", line 402, in run
    self.result_queue.put(answer)
NameError: global name 'answer' is not defined

Extract of the code:

396             try:
397                 with open(next_task) as nextfile:
398                     file_buffer = nextfile.read()
399             except IOError:
400                 logging.debug("Error opening: %s" % (next_task))
401                 self.task_queue.task_done()
402                 self.result_queue.put(answer)
403                 continue

I am not really sure how to fix this, sorry.

Montana commented 1 year ago

Hi @nbareil ,

I wouldn't recommended, but an option you have is passing it to the function deposit by typing and to call it:

use deposit(answer)
def deposit(answer):