Re: Problems using cron to run a python script

2008-03-05 Thread [EMAIL PROTECTED]
Thanks for all the help folks! I solved the issue this morning by running the python script via a BASH script that source my BASH_PROFILE, which contains exports my PYTHONPATH. Here is what the script looked like: #!/bin/bash . ~/.bash_profile /usr/bin/python

Re: Problems using cron to run a python script

2008-03-05 Thread Pigletto
> OK, I'm getting a different error now: > > Traceback (most recent call last): > File "update_feeds.py", line 58, in ? >update_feeds() > File "update_feeds.py", line 14, in update_feeds >from knoxd.apps.aggregator.models import Feed, FeedItem > ImportError: No module named

Re: Problems using cron to run a python script

2008-03-04 Thread Andrew Holt
Hi, OK, write a small script that runs you python job. Try running the job from the shell: /usr/bin/python -v /path/to/script/update_feeds.py This will list all the import statements, so find your imports that fail in the cron job ... And then your script would be: #!/bin/sh PYTHONPATH=

Re: Problems using cron to run a python script

2008-03-04 Thread Evert Rol
> OK, I'm getting a different error now: > > Traceback (most recent call last): > File "update_feeds.py", line 58, in ? > update_feeds() > File "update_feeds.py", line 14, in update_feeds > from knoxd.apps.aggregator.models import Feed, FeedItem > ImportError: No module named

Re: Problems using cron to run a python script

2008-03-04 Thread Evert Rol
> OK, I did what you instructed and checked the log file, which did > contain the system path and the traceback about the "can't import > module...". Your script did run (you thought it completely failed), but -only- up the 'import feedparser' part. Anything before that ('print sys.path')

Re: Problems using cron to run a python script

2008-03-04 Thread Malcolm Tredinnick
On Tue, 2008-03-04 at 09:43 -0800, [EMAIL PROTECTED] wrote: > I'm sorry, but I still don't understand what this will do here. > > The cron can't run the script because it can't import the feedparser > module or the models from my app. So it doesn't matter if I print the > system path. Again, my

Re: Problems using cron to run a python script

2008-03-04 Thread [EMAIL PROTECTED]
OK, I'm getting a different error now: Traceback (most recent call last): File "update_feeds.py", line 58, in ? update_feeds() File "update_feeds.py", line 14, in update_feeds from knoxd.apps.aggregator.models import Feed, FeedItem ImportError: No module named

Re: Problems using cron to run a python script

2008-03-04 Thread [EMAIL PROTECTED]
OK, I did what you instructed and checked the log file, which did contain the system path and the traceback about the "can't import module...". I see the paths specified don't contain the path to the feedparser module, which explains the error. My question is how do I add this path in the cron,

Re: Problems using cron to run a python script

2008-03-04 Thread Evert Rol
> Well part of the problem is that the script itself works fine. I can > run from the command line without a hitch. But when I try to run it > via the cron, I get the traceback about the feedparser module. I believe that, because your PYTHONPATH will be set correctly from the command line; but

Re: Problems using cron to run a python script

2008-03-04 Thread [EMAIL PROTECTED]
Hopefully, it will print the path before the import statement fails, and also log the error message that cron generates to a log. So it does matter if you print the sys.path, because that could tell you that the location of your feedparser module isn't on that path. I don't know about dreamhost,

Re: Problems using cron to run a python script

2008-03-04 Thread [EMAIL PROTECTED]
I'm sorry, but I still don't understand what this will do here. The cron can't run the script because it can't import the feedparser module or the models from my app. So it doesn't matter if I print the system path. Again, my problem is getting the python script to run from the cron in the first

Re: Problems using cron to run a python script

2008-03-04 Thread Evert Rol
> I'm not sure where to print the path. Do I add that to the > update_feeds.py? Or does this go in the cron itself? > > If I add it to the script, and then run the script from the command > line, it prints what's on my python path and then runs the script as > normal. > > But that's never been

Re: Problems using cron to run a python script

2008-03-04 Thread [EMAIL PROTECTED]
Do you have a link to more information about Django-cron? How do I go about using this? On Mar 4, 10:34 am, "Dj Gilcrease" <[EMAIL PROTECTED]> wrote: > On Tue, Mar 4, 2008 at 4:55 AM, [EMAIL PROTECTED] > > <[EMAIL PROTECTED]> wrote: > > >  I'm trying to use a cron job to run a python script that

Re: Problems using cron to run a python script

2008-03-04 Thread [EMAIL PROTECTED]
I'm not sure where to print the path. Do I add that to the update_feeds.py? Or does this go in the cron itself? If I add it to the script, and then run the script from the command line, it prints what's on my python path and then runs the script as normal. But that's never been the issue. The

Re: Problems using cron to run a python script

2008-03-04 Thread Dj Gilcrease
On Tue, Mar 4, 2008 at 4:55 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I'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: >

Re: Problems using cron to run a python script

2008-03-04 Thread Evert Rol
> Unfortunately, I get the same traceback: > > Traceback (most recent call last): > File "update_feeds.py", line 10, in ? > import feedparser > ImportError: No module named feedparser Again: did you print the sys.path? The 'cd' is not going to work, unless your modules are relative to the

Re: Problems using cron to run a python script

2008-03-04 Thread [EMAIL PROTECTED]
Unfortunately, I get the same traceback: Traceback (most recent call last): File "update_feeds.py", line 10, in ? import feedparser ImportError: No module named feedparser Any idea how to import the module within the cron? On Mar 4, 9:07 am, Jonas Christian <[EMAIL PROTECTED]> wrote: > I

Re: Problems using cron to run a python script

2008-03-04 Thread Jonas Christian
I ran into problems like that using cron and instead of trying to locate the real error in the paths (we were about to go live ...), I simple changed the cron line to read: 1 * * * * cd /path/to/script; /usr/bin/python update_feeds.py Why don't you try that and see if it helps... Jonas On 4

Re: Problems using cron to run a python script

2008-03-04 Thread [EMAIL PROTECTED]
Well part of the problem is that the script itself works fine. I can run from the command line without a hitch. But when I try to run it via the cron, I get the traceback about the feedparser module. On Mar 4, 7:36 am, Evert Rol <[EMAIL PROTECTED]> wrote: > > No, I haven't tried that. How would

Re: Problems using cron to run a python script

2008-03-04 Thread Evert Rol
> No, I haven't tried that. How would I go about citing that? Top of script (possibly just below the she-bang): import sys print sys.path >>> Traceback (most recent call last): >>> File "/path/to/script/update_feeds.py", line 10, in ? >>> import feedparser >>> ImportError: No module named

Re: Problems using cron to run a python script

2008-03-04 Thread [EMAIL PROTECTED]
No, I haven't tried that. How would I go about citing that? On Mar 4, 7:22 am, Evert Rol <[EMAIL PROTECTED]> wrote: > > Traceback (most recent call last): > > File "/path/to/script/update_feeds.py", line 10, in ? > > import feedparser > > ImportError: No module named feedparser > > > And here

Re: Problems using cron to run a python script

2008-03-04 Thread Evert Rol
> > 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

Problems using cron to run a python script

2008-03-04 Thread [EMAIL PROTECTED]
I'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