1

Temat: Speedtest w pythonie

Znalazłem fajny skrypt do testowanie szybkości neta : http://www.lowendguide.com/using-linux/ … using-vnc/ Jednak po odpaleniu skryptu dostaję:

root@Gargoyle:~# python speedtest.py --share
Retrieving speedtest.net configuration...
Traceback (most recent call last):
  File "speedtest.py", line 411, in <module>
    speedtest()
  File "speedtest.py", line 304, in speedtest
    config = getConfig()
  File "speedtest.py", line 192, in getConfig
    root = DOM.parseString(configxml)
  File "/usr/lib/python2.7/xml/dom/minidom.py", line 1929, in parseString
    from xml.dom import expatbuilder
  File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 32, in <module>
    from xml.parsers import expat
  File "/usr/lib/python2.7/xml/parsers/expat.py", line 4, in <module>
    from pyexpat import *
ImportError: No module named pyexpat

Czyżby python dostępny na gargulca nie zawierał wszystkiego potrzebnego do działania tego skryptu?

2

Odp: Speedtest w pythonie

zobacz

opkg update
opkg install python-expat

Pozdrawiam, Artur
http://digi-led.pl/blog - Blog

3 (edytowany przez sqbi 2013-05-11 20:57:38)

Odp: Speedtest w pythonie

@Kuri, zadziałało Ci? Mi wget nie chce z https współpracować a po http mam komunikat:

root@Gargoyle:~# wget http://raw.github.com/sivel/speedtest-cli/master/speedtest
-cli --no-check-certificate -O speedtest-cli.py
Connecting to raw.github.com (199.27.76.133:80)
Segmentation fault

edit: dobra, ręcznie to przerzuciłem na swój serwer i pobrałem, odpaliłem i...

root@Gargoyle:~# python speedtest-cli.py --share
Traceback (most recent call last):
  File "speedtest-cli.py", line 18, in <module>
    import urllib2
ImportError: No module named urllib2
root@Gargoyle:~# opkg install urllib2
Unknown package 'urllib2'.

mam doinstalować to czy co?

4

Odp: Speedtest w pythonie

ewget https://raw.github.com/sivel/speedtest-cli/master/speedtest-cli

?

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

5

Odp: Speedtest w pythonie

Mi też tak nie chciało iść. Pobrałem ręcznie na kompa po czym przez ftp sobie przesłałem...

6

Odp: Speedtest w pythonie

Zainstalowany mam python w wersji 2 więc powinno to działać. Plik dla wersji 3ciej też się wysypuje...

7

Odp: Speedtest w pythonie

Zostawię to tu, może komuś pomoże:

root@asusek:~/measurement/internet# opkg install wget
Installing wget (1.15-1) to root...
Downloading http://downloads.openwrt.org/barrier_breaker/14.07-rc3/brcm47xx/legacy/packages/wget_1.15-1_brcm47xx.ipk.
Installing libpcre (8.35-2) to root...
Downloading http://downloads.openwrt.org/barrier_breaker/14.07-rc3/brcm47xx/legacy/packages/libpcre_8.35-2_brcm47xx.ipk.
Configuring libpcre.
Configuring wget.
root@asusek:~/measurement/internet# wget --no-check-certificate -O speedtest-cli http://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
--2014-09-26 23:10:51--  http://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
Resolving raw.github.com... 185.31.17.133
Connecting to raw.github.com|185.31.17.133|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py [following]
--2014-09-26 23:10:51--  https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
Connecting to raw.github.com|185.31.17.133|:443... connected.
WARNING: cannot verify raw.github.com's certificate, issued by '/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance CA-3':
  Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest_cli.py [following]
--2014-09-26 23:10:52--  https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest_cli.py
Resolving raw.githubusercontent.com... 185.31.17.133
Connecting to raw.githubusercontent.com|185.31.17.133|:443... connected.
WARNING: cannot verify raw.githubusercontent.com's certificate, issued by '/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance CA-3':
  Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 200 OK
Length: 21791 (21K) [text/plain]
Saving to: 'speedtest-cli'

100%[==================================================================================================================================================

2014-09-26 23:10:53 (248 KB/s) - 'speedtest-cli' saved [21791/21791]

root@asusek:~/measurement/internet# chmod +x speedtest-cli
root@asusek:~/measurement/internet# ./speedtest-cli
Traceback (most recent call last):
  File "./speedtest-cli", line 54, in <module>
    from http.client import HTTPConnection, HTTPSConnection
ImportError: No module named http.client
root@asusek:~/measurement/internet# opkg install python-openssl
Installing python-openssl (2.7.3-2) to root...
Downloading http://downloads.openwrt.org/barrier_breaker/14.07-rc3/brcm47xx/legacy/packages/python-openssl_2.7.3-2_brcm47xx.ipk.
Configuring python-openssl.
root@asusek:~/measurement/internet# opkg install pyopenssl
Installing pyopenssl (0.10-1) to root...
Downloading http://downloads.openwrt.org/barrier_breaker/14.07-rc3/brcm47xx/legacy/packages/pyopenssl_0.10-1_brcm47xx.ipk.
Configuring pyopenssl.
root@asusek:~/measurement/internet# ./speedtest-cli
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from XXXXXXXXXX (XXX.XXX.XXX.XX)...
Selecting best server based on latency...
Hosted by FORWEB (Lodz) [45.97 km]: 94.665 ms
Testing download speed........................................
Download: 5.84 Mbits/s
Testing upload speed..................................................
Upload: 1.53 Mbits/s