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

Error when running "googledevices scan-network": "ValueError: 10.2.0.250/24 has host bits set" #46

Open
mitchnemirov opened this issue Jan 21, 2022 · 2 comments

Comments

@mitchnemirov
Copy link

Describe the bug
When attempting to run googledevices scan-network (or even any of the other network-fetching related options) I get the error below. It appears to be due to how the ipaddress Python module handles IP addresses with host bits when "strict" is set to True.

See the following for the ipaddress python documentation:
If strict is True and host bits are set in the supplied address, then ValueError is raised. Otherwise, the host bits are masked out to determine the appropriate network address.

Is there a way to set "strict" to False in the codebase where the ipaddress module is referenced?
Or is there another way I can work-around this issue?

Error

Error parsing information - timeout() got an unexpected keyword argument 'loop'
Traceback (most recent call last):
  File "/home/mitch/.local/bin/googledevices", line 8, in <module>
    sys.exit(CLI())
  File "/usr/lib/python3/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/mitch/.local/lib/python3.9/site-packages/googledevices/cli/cli.py", line 45, in scan_network
    command.scan_network(LOOP, network, feature)
  File "/home/mitch/.local/lib/python3.9/site-packages/googledevices/cli/commands/scan_network.py", line 55, in scan_network
    loop.run_until_complete(get_all_units())
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/mitch/.local/lib/python3.9/site-packages/googledevices/cli/commands/scan_network.py", line 47, in get_all_units
    result = await googledevices.scan_for_units(subnet)
  File "/home/mitch/.local/lib/python3.9/site-packages/googledevices/utils/scan.py", line 33, in scan_for_units
    for host in ipaddress.IPv4Network(iprange):
  File "/usr/lib/python3.9/ipaddress.py", line 1509, in __init__
    raise ValueError('%s has host bits set' % self)
ValueError: 10.2.0.250/24 has host bits set
@ludeeus
Copy link
Owner

ludeeus commented Feb 20, 2022

Even if that worked, nothing else would, see #44.
This entire package needs a full rewrite, and currently, I really don't see that happening anytime soon :/

@mitchnemirov
Copy link
Author

I found another project that had functions setup to read chromecast info (status, ip/mac addresses, etc) and they have instructions for getting authentication setup for the new auth flow Google pushed out (Link: rithvikvibhu/GHLocalApi#39).

I understand the sentiment though. No worries here, I haven't taken the time to get auth working with the other tool either as I've done another form of Chromecast testing to troubleshoot issues at work.

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