Page 1 of 1

python help

Posted: Tue Jun 28, 2005 10:36 pm
by SidewinderX
hello, i know absoltuley nothing about python other then how to run it on my linux server.

My friend coded this simple script for me

Code: Select all

#!/usr/bin/env python2 
import urllib2
import urllib

data = {'pid': '40478458384'}
data = urllib.urlencode(data)
for line in urllib2.urlopen('http://www.extreme-hq.com/other/dfx/test/stats.php', data):
	pass
but it dosnt work on my local server nor my server i rent my web space from (it works on his server)

this is the error i get
[root@localhost html]# python /var/www/html/update.py
Traceback (most recent call last):
File "/var/www/html/update.py", line 7, in ?
for line in urllib2.urlopen('http://www.extreme-hq.com/other/dfx/test/stats.php', data):
TypeError: iteration over non-sequence
i dont know what any of this means or does, i know what the script is suppose to do, but im sure anyone who knows python can figure that out, does anyone know how i can fix this code?

any help what so ever is appreciated, thanks

Posted: Wed Jun 29, 2005 12:37 am
by SidewinderX
well i updated to python 2.4 and it works fine which means the server i rent my space from dosnt have the latest version of python. i doubt they will update their version but idk. is there anyway i can get this script to run on python 2.2 ?