I quite often use the python -m SimpleHTTPServer command in the Terminal to fire up a webserver for testing apps. Having just learned the basics of the Automator, I figured this would be a great use for it - having added the following as a service I can now right-click on a folder and have a webserver launch pointing at that folder.

cd $1
python -m SimpleHTTPServer 8000

The only problem I have, is the lack of output from the workflow. Doing it manually I have a Terminal window displaying the requests coming in and enabling me to Ctrl+C to end the webserver.

The Automator workflow is silent and I have to open Activity Monitor and quit Python to close it. Is there a way to have it run the script in a Terminal window?

2 Answers 2


Figured out how to do it myself based upon adapting the following article.


Added a line in to run the python command:

on run {input, parameters}
  tell application "Terminal"
    if (the (count of the window) = 0) or ¬
     (the busy of window 1  = true) then
      tell application "System Events"
        keystroke "n" using command down
      end tell
    end if
    do script "cd \"" & (POSIX path of ¬
     (input as string)) & "\"" in window 1
    do script "python -m SimpleHTTPServer 8000" in window 1
  end tell
  return input
end run
  • Replace the 'tell application "System Events"' block with just "do script". A "do script" command with no parameters will open a new terminal window. Simulating keystrokes is an unreliable means to script an application; only do it as a last resort, if there's no means to directly tell it to do what you want.
    – Chris Page
    Sep 26, 2011 at 14:16
  • That "do script" command won't work will all valid pathnames. Remove the quotes from the shell command string (\") and use quoted form of (POSIX path of (input as string)) instead. quoted form of knows how to correctly quote all characters that need to be quoted for shell commands.
    – Chris Page
    Sep 26, 2011 at 14:23

If you like using Automator try the Growl Notifier in Automator (below is an example). Growl is extensible to almost any application/script/service on OS X. It works really well for showing output for just about anything imaginable.

Auto Growling

  • Doesn't seem to work with python, still no output anywhere. Sep 21, 2011 at 6:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .