Skip to content

Commit

Permalink
Handle case where ignoreids is empty or contains empty ids
Browse files Browse the repository at this point in the history
  • Loading branch information
sivel committed Apr 8, 2021
1 parent db46af8 commit cadc68b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions speedtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,9 +1174,9 @@ def get_config(self):
# times = get_attributes_by_tag_name(root, 'times')
client = get_attributes_by_tag_name(root, 'client')

ignore_servers = list(
map(int, server_config['ignoreids'].split(','))
)
ignore_servers = [
int(i) for i in server_config['ignoreids'].split(',') if i
]

ratio = int(upload['ratio'])
upload_max = int(upload['maxchunkcount'])
Expand Down

4 comments on commit cadc68b

@faxm0dem
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks now it works again :-)

@LOSanchez
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works, Thanks!

@thomasmerz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sivel
Is this a coincidence or why was my speedtest-cli (2.1.2) on Ubuntu crashing starting on Apr, 8th with this ValueError and since/with 2.1.3 everything is fine again? 😄

Retrieving speedtest.net configuration...
Traceback (most recent call last):
  File "/usr/bin/speedtest", line 11, in <module>
    load_entry_point('speedtest-cli==2.1.2', 'console_scripts', 'speedtest')()
  File "/usr/lib/python3/dist-packages/speedtest.py", line 1986, in main
    shell()
  File "/usr/lib/python3/dist-packages/speedtest.py", line 1872, in shell
    speedtest = Speedtest(
  File "/usr/lib/python3/dist-packages/speedtest.py", line 1091, in __init__
    self.get_config()
  File "/usr/lib/python3/dist-packages/speedtest.py", line 1173, in get_config
    ignore_servers = list(
ValueError: invalid literal for int() with base 10: ''

But I'm sorry that I needed to fix #!/usr/bin/env python to #!/usr/bin/env python3 by myself on my Ubuntu 20.4 LTS where I have not Python 2 available/installed anymore. (#770)

@Veltys
Copy link

@Veltys Veltys commented on cadc68b Apr 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much!! Works fine again 👍🏼

Please sign in to comment.