Running python script using cron


#1

'm trying to use a cron job to run a python script that updates feeds
on an aggregator site I’m building. But I’m getting trackback errors
telling me it can’t import the module feedparser. Here’s the error:

Traceback (most recent call last):
File “/path/to/script/update_feeds.py”, line 10, in ?
import feedparser
ImportError: No module named feedparser

And here is the cron:

export PYTHONPATH=/path/to/python2.3/site-packages:/path/to/django/app
export DJANGO_SETTINGS_MODULE=myproject.settings
1 * * * * /usr/bin/python /path/to/script/update_feeds.py

Any suggestions on what I’m doing wrong?


#2

[quote]File “/path/to/script/update_feeds.py”, line 10, in ?
import feedparser
ImportError: No module named feedparser[/quote]
As the error indicates, you are failed to import a module. Is the module properly installed or imported?

$50 off and 3 free domains with code: [color=#CC0000]DH3[/color] Sign Up NOW or More Codes Here


#3

I’m not sure how to do this in the cron job.

I can run the script fine from the command line.


#4

That sounds a bit harsh LOL.

si-blog
Max discount on any plan with promocode SCJESSEYTOTAL


#5

Do you have any advice on this issue?


#6

Nope. I just thought the comment came out a bit funny, that’s all.

si-blog
Max discount on any plan with promocode SCJESSEYTOTAL


#7

Sorry about my English. It should be “you failed to”. I’ll be more careful next time.

$50 off and 3 free domains with code: [color=#CC0000]DH3[/color] Sign Up NOW or More Codes Here


#8

What is the command you used to run your script from command line?

$50 off and 3 free domains with code: [color=#CC0000]DH3[/color] Sign Up NOW or More Codes Here


#9

$ python /home/user/path/to/script/update_feeds.py


#10

I solved the issue this morning. Here is a link to my post explaining how I did it: http://groups.google.com/group/django-users/msg/aad5a64db2668d3f