urllib working differently when run from crontab

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • VictorMiller

    urllib working differently when run from crontab

    I've written a python script which, using urllib, and urllib2 will
    fetch a number of files that that I'm interested in from various
    websites (they're updated everyday). When I run the script from my
    command line everything works as intended. However, when the script
    is run from crontab every single url that I attempt to open gets
    "connection refused". Has anyone ever seen anything like this? If
    so, what's causing it, and what can I do about it?

    Victor
  • Jonathan Gardner

    #2
    Re: urllib working differently when run from crontab

    On Apr 13, 8:50 pm, VictorMiller <victorsmil...@ gmail.comwrote:
    I've written a python script which, using urllib, and urllib2 will
    fetch a number of files that that I'm interested in from various
    websites (they're updated everyday).  When I run the script from my
    command line everything works as intended.  However, when the script
    is run from crontab every single url that I attempt to open gets
    "connection refused".  Has anyone ever seen anything like this?  If
    so, what's causing it, and what can I do about it?
    >
    Try su'ing as the user and running the scripts. Maybe that will shed
    some light on the problem.

    Comment

    • Matthew Woodcraft

      #3
      Re: urllib working differently when run from crontab

      In article <e40f9146-a4fa-456a-9bc6-34aa4c8dd42b@a7 0g2000hsh.googl egroups.com>,
      VictorMiller <victorsmiller@ gmail.comwrote:
      I've written a python script which, using urllib, and urllib2 will
      fetch a number of files that that I'm interested in from various
      websites (they're updated everyday). When I run the script from my
      command line everything works as intended. However, when the script
      is run from crontab every single url that I attempt to open gets
      "connection refused". Has anyone ever seen anything like this? If
      so, what's causing it, and what can I do about it?
      Perhaps you have an http_proxy environment variable set in the
      interactive session but not in cron's environment?

      -M-

      Comment

      • VictorMiller

        #4
        Re: urllib working differently when run from crontab

        On Apr 14, 8:33 am, Matthew Woodcraft
        <matth...@chiar k.greenend.org. ukwrote:
        In article <e40f9146-a4fa-456a-9bc6-34aa4c8dd...@a7 0g2000hsh.googl egroups.com>,
        >
        VictorMiller <victorsmil...@ gmail.comwrote:
        I've written a python script which, using urllib, and urllib2 will
        fetch a number of files that that I'm interested in from various
        websites (they're updated everyday). When I run the script from my
        command line everything works as intended. However, when the script
        is run from crontab every single url that I attempt to open gets
        "connection refused". Has anyone ever seen anything like this? If
        so, what's causing it, and what can I do about it?
        >
        Perhaps you have an http_proxy environment variable set in the
        interactive session but not in cron's environment?
        >
        Aha! Thanks, I think that that may indeed be the problem. I'll know
        for sure tomorrow morning after I look at the trace of the run.

        Victor
        -M-

        Comment

        Working...