Skip to content

UnboundLocalError: local variable 'code' referenced before assignment #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hiteshnitetc opened this issue Nov 7, 2017 · 5 comments

Comments

@hiteshnitetc
Copy link

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
Copy link
Author

Waiting for response

@andersy005
Copy link
Owner

andersy005 commented Nov 14, 2017

@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
Copy link
Owner

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.

@hiteshnitetc
Copy link
Author

Have to got solution

@hiteshnitetc
Copy link
Author

You Got solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants