keras-faster-rcnn icon indicating copy to clipboard operation
keras-faster-rcnn copied to clipboard

UnboundLocalError: local variable 'code' referenced before assignment

Open hiteshnitetc opened this issue 6 years ago • 5 comments

After executing following line : from data import pascal_voc_parser as p

getting error:

importing Jupyter notebook from /home/nd/keras-faster-rcnn-master/data/pascal_voc_parser.ipynb


UnboundLocalErrorTraceback (most recent call last)
<ipython-input-9-6e3d7e764de9> in <module>()
----> 1 from data import pascal_voc_parser as p

/home/nd/anaconda3/lib/python3.6/importlib/_bootstrap.py in _find_and_load(name, import_)

/home/nd/anaconda3/lib/python3.6/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

/home/nd/anaconda3/lib/python3.6/importlib/_bootstrap.py in _load_unlocked(spec)

/home/nd/anaconda3/lib/python3.6/importlib/_bootstrap.py in _load_backward_compatible(spec)

<ipython-input-5-928f04d1cf08> in load_module(self, fullname)
     38                         code = self.shell.input_transformer_manager.transform_cell(cell.source)
     39                         # run the code in themodule
---> 40                     exec(code, mod.__dict__)
     41         finally:
     42             self.shell.user_ns = save_user_ns

UnboundLocalError: local variable 'code' referenced before assignment

hiteshnitetc avatar Nov 07 '17 15:11 hiteshnitetc

Waiting for response

hiteshnitetc avatar Nov 13 '17 04:11 hiteshnitetc

@hiteshnitetc, I think I know what it is happening. And it has to do with how the jupyter notebook is being imported. I have a script here that does the import for me and I have placed it one of my personal projects (https://github.com/andersy005/themachine/blob/master/themachine/nbfinder.py).

Copy that script to your project working directory and getting back to me if it doesn't work and I will see what I can do to help.

andersy005 avatar Nov 14 '17 04:11 andersy005

wait, I just inspected the error and I think something else is going on. I will take a look at it and I will get back to you.

andersy005 avatar Nov 14 '17 05:11 andersy005

Have to got solution

hiteshnitetc avatar Nov 14 '17 13:11 hiteshnitetc

You Got solution?

hiteshnitetc avatar Nov 17 '17 08:11 hiteshnitetc