LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   can anyone help me pl with this eror i a python script (https://www.linuxquestions.org/questions/programming-9/can-anyone-help-me-pl-with-this-eror-i-a-python-script-212796/)

safrout 08-03-2004 02:38 AM

can anyone help me pl with this eror i a python script
 
i made this script about 3 months ago and it was working very good till few days ag where i started getting this error and i don't know why

Code:


import urllib, commands, datetime
i = commands.getoutput("lynx -dump -nolist -auth safrout:sa1782ao http://10.0.0.138/ip.htm | grep '^ *[0-9].*ppp$' -m 1 | cut -c 4-15")
x= commands.getoutput ("host safrout.homelinux.net | cut -c 35-46")
url="http://aokda:saf1782ao@members.dyndns.org/nic/update?system=dyndns&hostname=safrout.homelinux.net&myip="+i+"&wildcard=OFF&backmx=NO&offline=NO"
def compare():
  if x == i :
    print datetime.datetime.now(),"-->", i,"=", x
    exit
  else:
    url_new = urllib.urlopen(url)
    print datetime.datetime.now(), "ur IP was changed to ", url_new.read(), ", and it up2date now :)"
compare()

and the error looks like this

Code:

safrout@home IP-Update $ python ip_update.py
Traceback (most recent call last):
  File "ip_update.py", line 12, in ?
    compare()
  File "ip_update.py", line 10, in compare
    url_new = urllib.urlopen(url)
  File "/usr/lib/python2.3/urllib.py", line 76, in urlopen
    return opener.open(url)
  File "/usr/lib/python2.3/urllib.py", line 181, in open
    return getattr(self, name)(url)
  File "/usr/lib/python2.3/urllib.py", line 281, in open_http
    if not host: raise IOError, ('http error', 'no host given')
IOError: [Errno http error] no host given

maybe it is a silly error but really i can't figure it out


All times are GMT -5. The time now is 01:52 PM.