473,395 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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
Jun 27 '08 #1
3 2132
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.

Jun 27 '08 #2
In article <e4**********************************@a70g2000hsh. googlegroups.com>,
VictorMiller <vi***********@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-

Jun 27 '08 #3
On Apr 14, 8:33 am, Matthew Woodcraft
<matth...@chiark.greenend.org.ukwrote:
In article <e40f9146-a4fa-456a-9bc6-34aa4c8dd...@a70g2000hsh.googlegroups.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-
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Arkascha | last post by:
Maybe someone can give me a short help with this... I got a server application in a LAMP environment doing batch tasks. A cronjob serves as a regular trigger, a metronom. The trigged...
3
by: Frank R. Suchy | last post by:
Hi, I want a php-script to maintain (some of) "my" cron jobs. Therefore it has to modify some crontab.txt (no problem) and has to execute crontab. But since php runs as the apache-user it...
4
by: Gary Feldman | last post by:
I think I've found a deficiency in the design of urllib related to https. In order to complete an https connection, it appears that URLOpener and hence FancyURLOpener require the key and cert...
7
by: Stuart McGraw | last post by:
I just spent a $*#@!*&^&% hour registering at ^$#@#%^ Sourceforce and trying to submit a Python bug report but it still won't let me. I give up. Maybe someone who cares will see this post, or...
0
by: Shane Hathaway | last post by:
I started experimenting with SOAPpy yesterday and immediately hit a snag. Both web services I tried simply hung and never replied. After a lot of digging, I found out what was going wrong:...
3
by: rbt | last post by:
How can I safely append a crontab entry to a crontab file progammatically with Python? I need to handle crontabs that currently have entries and crontabs that are empty. Also, I'd like this to...
3
by: dburdick | last post by:
I was referred to this forum as this may be a php specific problem. Some kind of configuration problem maybe. I have some php files that connect to a mysql database and are run as cron jobs. ...
1
by: blueeyesblue | last post by:
I have a file named query.sql inside which I have 2 lines as follows: --------------------------------------------------------------------- connect to test; select * from DF_MOVIE_MOVIE where...
0
by: Jerry Hill | last post by:
On Fri, Oct 3, 2008 at 5:38 PM, Valery Khamenya <khamenya@gmail.comwrote: Do you know what, exactly, you'd like the result to be? The encoding of unicode characters into URIs is not well...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.