Skip to content
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

UnboundLocalError: local variable 'data' referenced before assignment #1211

Closed
m1009d opened this issue Oct 17, 2022 · 3 comments
Closed

UnboundLocalError: local variable 'data' referenced before assignment #1211

m1009d opened this issue Oct 17, 2022 · 3 comments
Assignees

Comments

@m1009d
Copy link

m1009d commented Oct 17, 2022

There is an unhandled case when the data variable is not set in the start_shell.py#L82 and the script will fail:

Traceback (most recent call last):
  File "/home/mdieska/git/michal_dieska/scripts/dcn/configure_users_from_scratch/configure_users_from_scratch.py", line 458, in configure_users
    result = run_shell_commands(
  File "/home/mdieska/git/michal_dieska/scripts/dcn/configure_users_from_scratch/configure_users_from_scratch.py", line 578, in run_shell_commands
    with StartShell(device, timeout=timeout) as shell:
  File "/home/mdieska/git/venv/lib/python3.10/site-packages/jnpr/junos/utils/start_shell.py", line 202, in __enter__
    self.open()
  File "/home/mdieska/git/venv/lib/python3.10/site-packages/jnpr/junos/utils/start_shell.py", line 125, in open
    got = self.wait_for(r"(%|>|#|\$)")
  File "/home/mdieska/git/venv/lib/python3.10/site-packages/jnpr/junos/utils/start_shell.py", line 81, in wait_for
    if isinstance(data, bytes):
UnboundLocalError: local variable 'data' referenced before assignment
@m1009d
Copy link
Author

m1009d commented Oct 17, 2022

Proposed solution:

#1212

@chidanandpujar
Copy link
Collaborator

Hi ,

Please share the steps to reproduce this issue .

Thanks
Chidanand

@ipmonk
Copy link
Contributor

ipmonk commented Nov 30, 2022

this looks same as #1203, fixed by #1207

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

No branches or pull requests

3 participants