Try telling crontab to execute your script with python ;)
Or put #!/usr/bin/env python on the first line and chmod appropriately

-cheers
matt

On Sat, Nov 15, 2008 at 12:41 AM, laspal <[EMAIL PROTECTED]> wrote:
>
> Ok I got the point but I run into some other problem.
>
> when I run python /home/laspal/test/test.py It run without giving any
> error.
>
> but when I do crontab -e and add the file
> -> */5 * * * *  /home/laspal/work/ibms/triget_mail.py > /tmp/foo.log
> 2>&1
>
> and go to /tmp/foo.log I am getting error
>
> /home/laspal/test/test.py: 1: import: not found
> /home/laspal/test/test.py: 2: import: not found
> /home/laspal/test/test.py: 4: Syntax error: "(" unexpected
>
> How can I fix it??
>
> Thanks
>
>
>
> On Nov 14, 4:09 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>> On Fri, 2008-11-14 at 02:52 -0800,laspalwrote:
>> > Hi,
>> > I am trying to writecronjob for trigger mail whenever task is
>> > overdue.
>>
>> [... snip ...]
>>
>> > So my problem is how do I run it.I mean how can I connect to my djanog
>> > project??
>> > here is my project path -> /home/work/test/
>> > my settings.py and trigger_mail.py is in the same folder.
>>
>> > The full code is not here I just wanted to know how can I run this
>> > trigger_mail.py file from django.
>>
>> These sentences don't make sense. What we call "Django" is a collection
>> of modules and libraries that you import and use. There's no concept of
>> running something "from Django" or "connecting to a project".
>>
>> Crontab will execute your script from time to time (however frequently
>> you configure it to be run) and that's all that is needed. You import
>> the bits you need and call them as required, as you seem to be doing in
>> your code fragment.
>>
>> Regards,
>> Malcolm
> >
>

--~--~---------~--~----~------------~-------~--~----~
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