<HTML>
<style> BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }</style>How about running the python exec directly from the virtual env :<br>
<br>
/Users/me/Desktop/virtual_python_root/bin/python<br>
Python 2.5.1 (r251:54863, Jun 17 2009, 20:37:34) <br>
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin<br>
Type "help", "copyright", "credits" or "license" for more information.<br>
>>> import wx<br>
>>> wx.__path__<br>
['/Users/me/Desktop/virtual_python_root/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx']<br>
<br>
it seams work work correctly (correct me if I'm wrong). I the wrote my plist like so :<br>
<br>
<?xml version="1.0" encoding="UTF-8"?><br>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br>
<plist version="1.0"><br>
<dict><br>
<key>StandardOutPath</key><br>
<string>test.log</string><br>
<key>StandardErrorPath</key><br>
<string>test-err.log</string><br>
<key>EnvironmentVariables</key><br>
<dict><br>
<key>PYTHONPATH</key><br>
<string>/Users/me/Desktop/virtual_python_root/lib/python2.5/site-packages:/Users/me/Desktop/myproj</string><br>
<string>DYLD_LIBRARY_PATH</string><br>
<string>/Users/me/Desktop/virtual_python_root/wx/2.8/lib</string><br>
</dict><br>
<key>KeepAlive</key><br>
<dict><br>
<key>SuccessfulExit</key><br>
<false/><br>
</dict><br>
<key>Label</key><br>
<string>com.test.virtualenv</string><br>
<key>Program</key><br>
<string>/Users/me/Desktop/virtual_python_root/bin/python</string><br>
<key>ProgramArguments</key><br>
<array><br>
<string>python.virtualenv</string><br>
<string>./launcher.py</string><br>
<string>app1</string><br>
</array><br>
<key>WorkingDirectory</key><br>
<string>/Users/me/Desktop/Arimaz-Trunk/src</string><br>
</dict><br>
</plist><br>
<br>
and again it seams to work (correct me again if I messed up somewhere).<br>
<br>
What is the advantage of using your method?<br>
<br>
Gabriel<br>
<br>
<br>
<span style="font-weight: bold;">On Fri 25/09/09 17:01 , "Orestis Markou" orestis@orestis.gr sent:<br>
</span><blockquote style="border-left: 2px solid rgb(245, 245, 245); margin-left: 5px; margin-right: 0px; padding-left: 5px; padding-right: 0px;">No need for a wrapper script. In recent versions of virtualenv, you <br>
can do this:<br>
<br>
activate_this = 'path/to/virtualenv/bin/activate_this.py'<br>
if os.path.exists(activate_this):<br>
execfile(activate_this, dict(__file__=activate_this))<br>
<br>
On 25 Σεπ 2009, at 3:56 μ.μ., Gabriel Rossetti wrote:<br>
<br>
<span style="color: rgb(102, 102, 102);">> Hello everyone,</span><br>
<span style="color: rgb(102, 102, 102);">></span><br>
<span style="color: rgb(102, 102, 102);">> I would like to create a Launchd plist entry to start a virtualenv </span><br>
<span style="color: rgb(102, 102, 102);">> and run a python project. I created my plist, but I'm not sure how </span><br>
<span style="color: rgb(102, 102, 102);">> to get it to activate the virtualenv and run the program. I thought </span><br>
<span style="color: rgb(102, 102, 102);">> that maybe I could create two <dict> emtries :</dict></span><br>
<span style="color: rgb(102, 102, 102);">></span><br>
<span style="color: rgb(102, 102, 102);">>         </span><br>
<span style="color: rgb(102, 102, 102);">>         </span><br>
<span style="color: rgb(102, 102, 102);">>                 "<a target="_blank" href="parse.php?redirect=<a href="http://www.apple.com/DTDs/PropertyList-1.0.dtd%26quot%3B%26gt">http://www.apple.com/DTDs/PropertyList-1.0.dtd%26quot%3B%26gt</a>"><span style="color: red;">http://www.apple.com/DTDs/PropertyList-1.0.dtd"></span></a>;</span><br>
<span style="color: rgb(102, 102, 102);">>         <plist version="1.0"></plist></span><br>
<span style="color: rgb(102, 102, 102);">>         <dict></dict></span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>Label</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <string>com.example.virtualenv</string></span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>Program</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <string>source</string></span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>ProgramArguments</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <array></array></span><br>
<span style="color: rgb(102, 102, 102);">>                         <string>/path/to/myvirtualenv/bin/activate</string></span><br>
<span style="color: rgb(102, 102, 102);">>                 </span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>RunAtLoad</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <true></true></span><br>
<span style="color: rgb(102, 102, 102);">>         </span><br>
<span style="color: rgb(102, 102, 102);">>         <dict></dict></span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>Label</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <string>com.example.app</string></span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>Program</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <string>python</string></span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>ProgramArguments</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <array></array></span><br>
<span style="color: rgb(102, 102, 102);">>                         <string>/path/to/myproj/launcher.py</string></span><br>
<span style="color: rgb(102, 102, 102);">>                         <string>start</string></span><br>
<span style="color: rgb(102, 102, 102);">>                 </span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>RunAtLoad</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <true></true></span><br>
<span style="color: rgb(102, 102, 102);">>         </span><br>
<span style="color: rgb(102, 102, 102);">>         </span><br>
<span style="color: rgb(102, 102, 102);">></span><br>
<span style="color: rgb(102, 102, 102);">></span><br>
<span style="color: rgb(102, 102, 102);">> but I'm not sure I can do that, and I have 2 programs to run for my </span><br>
<span style="color: rgb(102, 102, 102);">> project, so would I create 3<dict> entries like so :</dict></span><br>
<span style="color: rgb(102, 102, 102);">></span><br>
<span style="color: rgb(102, 102, 102);">>         </span><br>
<span style="color: rgb(102, 102, 102);">>         </span><br>
<span style="color: rgb(102, 102, 102);">>                 "<a target="_blank" href="parse.php?redirect=<a href="http://www.apple.com/DTDs/PropertyList-1.0.dtd%26quot%3B%26gt">http://www.apple.com/DTDs/PropertyList-1.0.dtd%26quot%3B%26gt</a>"><span style="color: red;">http://www.apple.com/DTDs/PropertyList-1.0.dtd"></span></a>;</span><br>
<span style="color: rgb(102, 102, 102);">>         <plist version="1.0"></plist></span><br>
<span style="color: rgb(102, 102, 102);">> <!-- The virtualenv --></span><br>
<span style="color: rgb(102, 102, 102);">>         <dict></dict></span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>Label</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <string>com.example.virtualenv</string></span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>Program</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <string>source</string></span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>ProgramArguments</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <array></array></span><br>
<span style="color: rgb(102, 102, 102);">>                         <string>/path/to/myvirtualenv/bin/activate</string></span><br>
<span style="color: rgb(102, 102, 102);">>                 </span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>RunAtLoad</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <true></true></span><br>
<span style="color: rgb(102, 102, 102);">>         </span><br>
<span style="color: rgb(102, 102, 102);">> <!-- My app 1 --></span><br>
<span style="color: rgb(102, 102, 102);">>         <dict></dict></span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>Label</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <string>com.example.app1</string></span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>Program</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <string>python</string></span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>ProgramArguments</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <array></array></span><br>
<span style="color: rgb(102, 102, 102);">>                         <string>/path/to/myproj/launcher.py</string></span><br>
<span style="color: rgb(102, 102, 102);">>                         <string>app1</string></span><br>
<span style="color: rgb(102, 102, 102);">>                         <string>start</string></span><br>
<span style="color: rgb(102, 102, 102);">>                 </span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>RunAtLoad</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <true></true></span><br>
<span style="color: rgb(102, 102, 102);">>         </span><br>
<span style="color: rgb(102, 102, 102);">> <!-- My app 2 --></span><br>
<span style="color: rgb(102, 102, 102);">>         <dict></dict></span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>Label</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <string>com.example.app2</string></span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>Program</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <string>python</string></span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>ProgramArguments</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <array></array></span><br>
<span style="color: rgb(102, 102, 102);">>                         <string>/path/to/myproj/launcher.py</string></span><br>
<span style="color: rgb(102, 102, 102);">>                         <string>app2</string></span><br>
<span style="color: rgb(102, 102, 102);">>                         <string>start</string></span><br>
<span style="color: rgb(102, 102, 102);">>                 </span><br>
<span style="color: rgb(102, 102, 102);">>                 <key>RunAtLoad</key></span><br>
<span style="color: rgb(102, 102, 102);">>                 <true></true></span><br>
<span style="color: rgb(102, 102, 102);">>         </span><br>
<span style="color: rgb(102, 102, 102);">>         </span><br>
<span style="color: rgb(102, 102, 102);">></span><br>
<span style="color: rgb(102, 102, 102);">> Or is there a better/another way to do this?</span><br>
<span style="color: rgb(102, 102, 102);">> _______________________________________________</span><br>
<span style="color: rgb(102, 102, 102);">> Pythonmac-SIG maillist - <a href="javascript:top.opencompose('Pythonmac-SIG@python.org','','','')">Pythonmac-SIG@python.org</a></span><br>
<span style="color: rgb(102, 102, 102);">> <a target="_blank" href="parse.php?redirect=<a href="http://mail.python.org/mailman/listinfo/pythonmac-sig">http://mail.python.org/mailman/listinfo/pythonmac-sig</a>"><span style="color: red;">http://mail.python.org/mailman/listinfo/pythonmac-sig</span></a></span><br>
<br>
<br>
</blockquote></HTML>