ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Create a button / utility to execute a script from administrative pages?

October 03, 2009 8:38pm

Subscribe [4]
  • #1 / Oct 03, 2009 8:38pm

    Hi

    I would like to execute a script from the admin pages.  Basically want to provide a button / link (in Utilities, perhaps?) that can be clicked in the admin pages, that will run a Python script on the webserver.

    Is this possible?  Where can I read more (Googling the wrong terms, I guess)

    Thanks

    x

  • #2 / Oct 05, 2009 5:52am

    silenz

    1651 posts

    You could just create a Quick Link using the little symbol in the topmost navigation bar or through “My Account”. Those are account-specific though.

  • #3 / Oct 05, 2009 6:49pm

    Perfect!  thanks silenz.

    Can EE execute python?  So far no luck with these sort of statements….

    <?php 
    echo "Hello, World!";
    exec("sayhi.py");
    echo "Script executed";
    ?>
  • #4 / Oct 05, 2009 7:00pm

    Ingmar

    29245 posts

    EE is a PHP script. You can execute custom PHP commands, even in your templates, but not Python or other scripting languages.

  • #5 / Oct 05, 2009 7:42pm

    Greg Salt

    3988 posts

    Hi,

    I have successfully invoked a Ruby script from within an extension. Remember that the shebang and the permissions of the script need to be right (chmod +x) and that the script can’t interact directly with the user’s browsing session. So, if your Python script is supposed to ‘say hi’ then that won’t work. You could use your other script to do background data processing etc but I’m not sure whether PHP blocks while the other script is doing its stuff and I don’t how you’d pass data or notifications back to PHP - I only tried this out from a geeky, academic interest point of view (basically got the Ruby script to create a new file and write to it) and not for any real task.

    Cheers

    Dry

  • #6 / Oct 05, 2009 9:21pm

    ender

    1644 posts

    you’d have to use exec(‘python sayhi.py’) to run a python script through the python CLI.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases