Comments (10)
Interesting. That's possible. I will look into it this evening. Thanks for reporting it!
from pypia.
Hi Lars,
You can specify a region with the -r
flag-- the options are us
, int
(for non-US), and all
. pypia uses US by default. As an example, you could do:
pypia -r all -p
which should tabulate the average of 3 pings to each pia server worldwide.
I'm not sure about those exceptions-- can you tell me more about those?
Thanks
from pypia.
Yeah, but when I run that command I get those errors. Works fine if I ping the US servers. Could it be that some of the servers are down, so the script gets an 404 and errors out?
from pypia.
I have not been able to reproduce the error. Are you able to ping those IP addresses directly? In other words, from the terminal, for example ping 108.61.122.217
from pypia.
Just tried pinging some of the IP's and some packet loss is happening.
Guess it could be my network or my router borking up.
--- 177.154.139.203 ping statistics ---
22 packets transmitted, 20 received, 9% packet loss, time 21052ms
rtt min/avg/max/mdev = 239.779/240.049/240.334/0.266 ms
Not too sure if that could be why I get those python errors?
from pypia.
Might be-- in any case I should probably add some code to deal with uncooperative endpoints so that the program doesn't error out when there's a problem pinging one of the servers.
from pypia.
I have had the same problem. I live in Denmark and primarily uses european servers. Using pypia -r int -f
or pypia -r int -p
causes pypia to crash, if one of the servers are down. I solved it by adding a few lines of code to the ping method
in the latencies class
so the ping method
now looks like this:
def ping(self):
ip = self.q.get()
try:
result = subprocess.check_output(['ping', '-c', '3', ip]).decode('utf-8')
except subprocess.CalledProcessError:
self.q.task_done()
return
avg = float(result.split('=')[-1].split('/')[1])
self.latencies[ip] = avg
self.q.task_done()
I'm sure it can be done more eleganly, but it works for me.
/Saltani
from pypia.
@Saltani, this is great, thank you for debugging and submitting a workaround. I like the try/except to catch the CalledProcessError exception.
One thing I'd like to do is somehow notify the user that one of the endpoints failed. I think what I'll do instead of marking self.q.task_done()
in the except block, I'll assign the avg
for that ip to an arbitrarily high latency time, so that it is obvious that the ping failed for that endpoint, and so it will still get recorded in the latencies table.
from pypia.
fixed with 6099c5e
updated version on pypi to 0.3.6
from pypia.
Good solution. Works nicely, thanks a lot :-)
from pypia.
Related Issues (20)
- improve __repr__ for Latencies class HOT 1
- Request: Add option to uninstall HOT 3
- Error using pypia HOT 1
- pypia: command not found
- changed DNS due to leak HOT 1
- Killswitch? HOT 2
- Initialising problem with opensuse leap 15.0 HOT 4
- Pypia on Debian 9 Stretch
- openSUSE Tumbleweed Failed Execution HOT 1
- How to set up on Solus? HOT 2
- PyPia on Gentoo HOT 1
- Feature to check pypia status? HOT 2
- x HOT 1
- Error using pypia on PythonAnywhere HOT 2
- NetworkManager re-connect to vpn on boot? HOT 1
- Add raspian OS support (Raspberry Pi) HOT 2
- Support Gen4 Network HOT 7
- Unable to Connect - "client update needed" HOT 1
- "pypia -i" fails with error message "needs an internet connection"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pypia.