Skip to content

Conversation

@Tivasic
Copy link

@Tivasic Tivasic commented Oct 10, 2022

I found the following error in the code if I want to get a better server this way:

sp = speedtest.Speedtest()
best_servers = sp.get_servers()
sp.get_best_server(best_servers)

I get an error:

Traceback (most recent call last):
  File "/speedtest/main.py", line 18, in <module>
    test_connection()
  File "/speedtest/main.py", line 8, in test_connection
    sp.get_best_server(best_servers)
  File "\speedtest\venv\lib\site-packages\speedtest.py", line 1459, in get_best_server
    url = os.path.dirname(server['url'])
TypeError: 'float' object is not subscriptable

I also added the else block, otherwise the condition is incorrect on line 1456.

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

Successfully merging this pull request may close these issues.

1 participant