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

passing 'sleep' arg to StartShell run() results in NameError exception due to missing import of 'time' #1202

Closed
ipmonk opened this issue Aug 26, 2022 · 2 comments
Assignees

Comments

@ipmonk
Copy link
Contributor

ipmonk commented Aug 26, 2022

PyEZ version 2.6.5

#!/usr/bin/env python3
from jnpr.junos import Device
from jnpr.junos.utils.start_shell import StartShell

def try_run():
    dev = Device("foobar", user="foo", passwd="bar",port=22)
    with StartShell(dev) as ss:
        result = ss.run("hostname", sleep=2)
        print(result)
if __name__ == "__main__":
    try_run()

// result

Traceback (most recent call last):
  File "repro.py", line 26, in <module>
    try_run()
  File "repro.py", line 23, in try_run
    result = ss.run("hostname", sleep=2)
  File "/Users/foobar/scripts/pyez_test_scripts/venv/lib/python3.6/site-packages/jnpr/junos/utils/start_shell.py", line 195, in run
    got = "".join(self.wait_for(this, timeout, sleep=sleep))
  File "/Users/foobar/scripts/pyez_test_scripts/venv/lib/python3.6/site-packages/jnpr/junos/utils/start_shell.py", line 88, in wait_for
    time.sleep(sleep)
NameError: name 'time' is not defined
@chidanandpujar
Copy link
Collaborator

fix is under review - #1205

@chidanandpujar
Copy link
Collaborator

fixed #1205

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