cron job times out

Nikola Skoric nick-news at
Fri Nov 24 19:50:12 CET 2006


I have a few lines of code retrieving a web page and saving some 
variables from it to a log. And everything works nice from command line. 
but, when I make a cron job, I get an error:

Your "cron" job on fly
cd $HOME/bin/ ; python ; cd

produced the following output:

Traceback (most recent call last):
  File "", line 11, in ?
    response = urllib2.urlopen(req)
  File "/usr/local/lib/python2.4/", line 130, in urlopen
    return, data)
  File "/usr/local/lib/python2.4/", line 358, in open
    response = self._open(req, data)
  File "/usr/local/lib/python2.4/", line 376, in _open
    '_open', req)
  File "/usr/local/lib/python2.4/", line 337, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python2.4/", line 1021, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/local/lib/python2.4/", line 996, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error (145, 'Connection timed out')>

It seems that the connection timed out. But, every time I execute the 
script from the command line, everything goes fine. And every time he 
cron job triggers, it times out. How come?

"Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across the doorways of the bedrooms of my dreams" 

More information about the Python-list mailing list