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, but is your cron running as a different
user than you? If so, that could explain why you can run the command
from the shell when you login vs. running it as cron.

Derek

On Mar 4, 12:43 pm, "[EMAIL PROTECTED]"
<[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 problem is getting the python script to run
> from the cron in the first place.
>
> On Mar 4, 11:55 am, Evert Rol <[EMAIL PROTECTED]> wrote:
>
> > > 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 cron is what's throwing the
> > > error.
>
> > You're not reading: I wrote:
>
> > "
> > Top of script (possibly just below the she-bang):
> > import sys
> > print sys.path
>
> > "
>
> > and
>
> > "
>
> > 1 * * * * /usr/bin/python /path/to/script/update_feeds.py > /path/to/
> > script/update_feeds.log 2>&1
>
> > "
>
> > Then check your update_feeds.log. That gets the output generated from
> > update_feeds.py when run from cron.
>
> > (although I note that the web archive doesn't agree with my sent
> > emails; hmm...)
>
> > >>> 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 /path/to/script/
>
> > >> I may have a solution, but I first want to know if it's a path
> > >> problem.
>
> > >>> Any idea how to import the module within the cron?
>
> > >>> On Mar 4, 9:07 am, Jonas Christian <[EMAIL PROTECTED]> wrote:
> > >>>> 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 Mrz., 14:02, "[EMAIL PROTECTED]"
> > >>>> <[EMAIL PROTECTED]>
> > >>>> wrote:
>
> > >>>>> 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.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to