Jump to content

python IndexError


NCC10281982B
 Share

Recommended Posts

For fun I am trying to implement the python speed test discussed here: http://forums.overclockersclub.com/topic/203885-irate-comcast-subscriber-turns-raspberry-pi-into-a-watchdog-for-slow-internet-speeds/?p=2151728On my ubuntu box.

 

I think I have all the modules (that was fun) i need.

 

[email protected]:~$ ./speed_test
running test
/usr/bin/python: can't find '__main__' module in '/home/jeff/speedtest-cli'
ran

Traceback (most recent call last):
  File "./speed_test", line 67, in <module>
    test()
  File "./speed_test", line 28, in test
    d = lines[1][10:14]
IndexError: list index out of range

Share this post


Link to post
Share on other sites

Looks like something is bugging with the download lines its pulling from. Just for fun, try removing that line and see if the upload works?

Edited by Onion

Share this post


Link to post
Share on other sites

[email protected]:~$ ./speed_test
running test
/usr/bin/python: can't find '__main__' module in '/home/jeff/speedtest-cli/'
ran

Traceback (most recent call last):
  File "./speed_test", line 67, in <module>
    test()
  File "./speed_test", line 28, in test
    d = lines[1][10:14]
IndexError: list index out of range

I think this has to do with can't find main... wherever main is supposed to be,,,

Share this post


Link to post
Share on other sites

Did you install the additional speedtest-cli utility?

 

If you paste the code I could probably be more help. I know it is posted on the pastebin site but there are some edits that you would have to make in there to get it to work on your machine I believe.

Share this post


Link to post
Share on other sites

  • 1 year later...

I did this before in Linux Mint.

 

1. Download a copy of the python script speediest-cli . Or copy and paste the code into a file and rename it.

 

2.On Ubuntu or Linux you have to make it a executable to run  so open a terminal window and type  'sudo chmod a+x filename'.

  Now  if you type 'ls' to list what is in the directory you should see that the file name has changed color in my case green, Now its executable.

 

3. Run the file ' sudo python ./Filename. Thats it I think !!.

 

The 'a+x' I got off the internet some where it might not be the best practice but it works perfectly. Now you can schedule this to run when ever you want with crontab if you wish and pipe the results out to a file to have a look at later.

 

I hope this helps.

 

I have not been approved yet so I only get one post a day so I cant reply.

If you come across a way to change the servers for the speed test please let me know it could be useful Thanks !

 

Also I had a problem with 777 also and I found that above and it worked like a charm.

Edited by steelchizzle

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...