Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed help making a Python script starup on mac using Launch Agent and send output to a window
    primarykey
    data
    text
    <p>I've created a python script I wish to have run automatically when I log in on a mac, and need some help using a Launch Agent to do this. I used SO extensively getting things working up to this point, so I figured this was the place to ask, but I'm still fairly new to this, so I need some help.</p> <p>Here's what I've got so far and what I still need:</p> <p>I have a python script that I can run from the terminal. It periodically will output text to the terminal window whenever it does something important (uses the python 'print' command). It also creates a log of this elsewhere, but I also want the realtime update in a window that stays open.</p> <p>What I now need is a Launch Agent to start this script automatically on login and still output this text. I've gotten a basic Launch Agent working, but it runs the script in the background and I no longer can see the output. Based on my research so far, it looks like I can use the "StandardOutPath" keyword in the Lauch Agent .plist to redirect this output? I don't yet understand stdout/stdin/stderr in these programs well enough to understand how all of this works, but I was hoping to essentially redirect this output, perhaps to an xterm window or similar.</p> <p>I couldn't find a good example of this type of thing anywhere, so there may be a better way to do it, and I'm just not searching for the right thing. Any help or explanation on how all this works would be much appreciated.</p> <p>Updated: My working Launch Agent .plist:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="1.0"&gt; &lt;dict&gt; &lt;key&gt;Label&lt;/key&gt; &lt;string&gt;com.name.WVCS-0.1&lt;/string&gt; &lt;key&gt;RunAtLoad&lt;/key&gt; &lt;true/&gt; &lt;key&gt;ProgramArguments&lt;/key&gt; &lt;array&gt; &lt;string&gt;osascript&lt;/string&gt; &lt;string&gt;/Path/to/StartupScript&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/plist&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload