TypeError: 'float' object is not callable speedtest python
Question:
import speedtest
st = speedtest.Speedtest()
print('Loading server...')
st.get_servers()
print('Choosing best server...')
server = st.get_best_server()
print(f'Found: {server["host"]} located in {server["country"]} ')
print('Performing doonload...')
resDownload = st.download()
print('Perfotming upload...')
resUpload = st.upload()
resPing = st.results.ping()
print(f'''
--- SPEED TEST COMPLETE ---
Download speed [{resDownload / 1024 / 1024:.2f} Mbit/s]
Upload speed [{resUpload / 1024 / 1024:.2f} Mbit/s]
Ping [{resPing}] ms
''')
Traceback (most recent call last):
File "C:UsersCENSOREDDesktopWichtigespythonHackingtoolsspeed.py", line 15, in <module>
resPing = st.results.ping()
TypeError: 'float' object is not callable
I dont know what to do.
Can someone help me please I’m getting crazy xD
I have to write some more details so my hobbys are:
playing the drums, programming, and listen to black metal.
Answers:
I think the issue is that ping
is not a function. Try replacing this:
resPing = st.results.ping()
… with this:
resPing = st.results.ping
I got the same error and tried the solution of "constantstranger".
Now I am glad to say that it is working properly.
import speedtest
st = speedtest.Speedtest()
print('Loading server...')
st.get_servers()
print('Choosing best server...')
server = st.get_best_server()
print(f'Found: {server["host"]} located in {server["country"]} ')
print('Performing doonload...')
resDownload = st.download()
print('Perfotming upload...')
resUpload = st.upload()
resPing = st.results.ping()
print(f'''
--- SPEED TEST COMPLETE ---
Download speed [{resDownload / 1024 / 1024:.2f} Mbit/s]
Upload speed [{resUpload / 1024 / 1024:.2f} Mbit/s]
Ping [{resPing}] ms
''')
Traceback (most recent call last):
File "C:UsersCENSOREDDesktopWichtigespythonHackingtoolsspeed.py", line 15, in <module>
resPing = st.results.ping()
TypeError: 'float' object is not callable
I dont know what to do.
Can someone help me please I’m getting crazy xD
I have to write some more details so my hobbys are:
playing the drums, programming, and listen to black metal.
I think the issue is that ping
is not a function. Try replacing this:
resPing = st.results.ping()
… with this:
resPing = st.results.ping
I got the same error and tried the solution of "constantstranger".
Now I am glad to say that it is working properly.