question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

utils.sw.install gives int() argument must be a string, a bytes-like object or a number, not 'NoneType'

See original GitHub issue

I am trying to upgrade the EX2300 with 48 POE+ switch using below code. I don’t set any time out parameters in install function. Everything is using the default value.

with Device(host=hostname, user=junos_username, passwd=junos_password) as dev:
        print("Connecting to {}".format(hostname))
        if dev.connected:
            print("Device connected")
            sw = SW(dev)`
            ok = sw.install(
                package=firware_update_files,
                progress=my_progress,
                no_copy=True,
                validate=False,
                cleanfs=True,
            )

I get this exception

192.168.1.2:request-package-checks-pending-install rpc is not supported on given device
192.168.1.2:installing software ... please be patient ...
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/jnpr/junos/device.py", line 227, in timeout
    self._conn.timeout = int(value)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/jnpr/junos/decorators.py", line 24, in wrapper
    dev.timeout = restore_timeout
  File "/usr/local/lib/python3.8/dist-packages/jnpr/junos/device.py", line 229, in timeout
    raise RuntimeError(
RuntimeError: could not convert timeout value of None to an integer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/jnpr/junos/device.py", line 227, in timeout
    self._conn.timeout = int(value)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/..../devel/ros_ws/src/bg_sandbox/juno_config/scripts/juno_update.py", line 62, in <module>
    main()
  File "/home/..../devel/ros_ws/src/bg_sandbox/juno_config/scripts/juno_update.py", line 37, in main
    ok = sw.install(
  File "/usr/local/lib/python3.8/dist-packages/jnpr/junos/utils/sw.py", line 990, in install
    add_ok = self.pkgadd(
  File "/usr/local/lib/python3.8/dist-packages/jnpr/junos/utils/sw.py", line 240, in pkgadd
    rsp = self.rpc.request_package_add(**args)
  File "/usr/local/lib/python3.8/dist-packages/jnpr/junos/rpcmeta.py", line 364, in _exec_rpc
    return self._junos.execute(rpc, **dec_args)
  File "/usr/local/lib/python3.8/dist-packages/jnpr/junos/decorators.py", line 76, in wrapper
    return function(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/jnpr/junos/decorators.py", line 27, in wrapper
    dev.timeout = restore_timeout
  File "/usr/local/lib/python3.8/dist-packages/jnpr/junos/device.py", line 229, in timeout
    raise RuntimeError(
RuntimeError: could not convert timeout value of None to an integer

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
volans-commented, Jul 20, 2022

I got the same issue and I had to pass the conn_open_timeout parameter to the call to Device in my case to fix the issue.

It seems to me that the culprit, at least in my case, is this commit https://github.com/Juniper/py-junos-eznc/commit/84fe8c6fe337e2488893126517bf1dd2c1f6edbf because it uses None as default value for:

self._conn_open_timeout = kvargs.get('conn_open_timeout', None)

that is later used as a value for the timeout parameter inside open() at line 1312:

timeout=self._conn_open_timeout,
0reactions
Bischoffcommented, Jul 22, 2022

Thanks @chidanandpujar . I was also getting it from junos salt-proxy when trying to apply a Salt state.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: int() argument must be a string, a bytes-like object ...
int() argument must be a string, a bytes-like object, or a number, not 'NoneType'. According to the error, you can't convert strings type ......
Read more >
What does 'int() argument must be a string, a bytes like object ...
The error "int() argument must be a string, a bytes like object or a number, not 'NoneType'. Error saving date" means that the...
Read more >
Parsing arguments and building values — Python 3.11.1 ...
This format converts a bytes-like object to a C pointer to a character string; it does not accept Unicode objects. The bytes buffer...
Read more >
` TypeError: int() argument must be a string, a bytes-like object ...
I'm currently building a U-net model handling multiple input streams of data with Keras/Tensorflow's Functional API.
Read more >
Error Message: "int() argument must be a string, a bytes-like ...
Error Message: "int() argument must be a string, a bytes-like object or a number, not 'NoneType'" · Tags: · error · Fusion 360...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found