Crontab question: can not invoke Python script

Posted on 2009-02-18
Last Modified: 2012-05-06
Hi experts,

I have two Python scripts "A" and "B". In "A" I use "os.system(...)" to invoke script "B". If I manually run "A", then "B" can be invoked successfully. However, when I use crontab to execute "A", "B" does not run in this case.

Anybody knows how to fix this?

Thanks so much.
Question by:davidw88
    LVL 39

    Accepted Solution

    How are you calling B from the os.system() call? Just with "./ <params>" or with "python <params>" or similar? When running with cron, it might be necessary to use a full path to the python executable: os.system("/usr/bin/python <params>").

    Author Comment

    hi cxr,

    thanks for your reply. I used

    command = ("python %s") % (

    Following your suggestion I have added full path to the python executabe. so let's wait and see how it works.


    Author Comment

    It does not work.

    I just combined the two scripts into one script. This solved the problem.

    Thanks cxr for your reply. Appreciated.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Plenty of writing has gone on the web trying to compare Python with other competitive programming languages and vice versa. However, not much has been put into a wholistic perspective. This article should help you decide whether to adopt Python as a…
    Sequence is something that used to store data in it in very simple words. Let us just create a list first. To create a list first of all we need to give a name to our list which I have taken as “COURSE” followed by equals sign and finally enclosed …
    Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
    Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now