[Pythonmac-SIG] Lanchd + virtualenv

gabriel.rossetti at arimaz.com gabriel.rossetti at arimaz.com
Fri Sep 25 17:31:03 CEST 2009


How
about running the python exec directly from the virtual env :
 /Users/me/Desktop/virtual_python_root/bin/python
 Python 2.5.1 (r251:54863, Jun 17 2009, 20:37:34) 
 [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
 Type "help", "copyright", "credits" or "license" for more
information.
 >>> import wx
 >>> wx.__path__

['/Users/me/Desktop/virtual_python_root/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx']
 it seams work work correctly (correct me if I'm wrong). I the wrote
my plist like so :
                 StandardOutPath
                 test.log
                 StandardErrorPath
                 test-err.log
                 EnvironmentVariables
                         PYTHONPATH
                        
/Users/me/Desktop/virtual_python_root/lib/python2.5/site-packages:/Users/me/Desktop/myproj
                         DYLD_LIBRARY_PATH
                        
/Users/me/Desktop/virtual_python_root/wx/2.8/lib
                 KeepAlive
                         SuccessfulExit
                 Label
                 com.test.virtualenv
                 Program
                        
/Users/me/Desktop/virtual_python_root/bin/python
                 ProgramArguments
                         python.virtualenv
                         ./launcher.py
                         app1
                  WorkingDirectory
                  /Users/me/Desktop/Arimaz-Trunk/src
 and again it seams to work (correct me again if I messed up
somewhere).
 What is the advantage of using your method?
 Gabriel
 On Fri 25/09/09 17:01 , "Orestis Markou" orestis at orestis.gr sent:
 No need for a wrapper script. In recent versions of virtualenv, you 

 can do this:
      activate_this = 'path/to/virtualenv/bin/activate_this.py'
      if os.path.exists(activate_this):
          execfile(activate_this, dict(__file__=activate_this))
 On 25 Σεπ 2009, at 3:56 μ.μ., Gabriel Rossetti wrote:
 > Hello everyone,
 >
 > I would like to create a Launchd plist entry to start a virtualenv
 
 > and run a python project. I created my plist, but I'm not sure how
 
 > to get it to activate the virtualenv and run the program. I
thought  
 > that maybe I could create two  emtries :
 >
 >  
 >  
 >  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">;
 >  
 >  
 >  Label
 >  com.example.virtualenv
 >  Program
 >  source
 >  ProgramArguments
 >  
 >  /path/to/myvirtualenv/bin/activate
 >  
 >  RunAtLoad
 >  

 >  
 >  
 >  Label
 >  com.example.app
 >  Program
 >  python
 >  ProgramArguments
 >  
 >  /path/to/myproj/launcher.py
 >  start
 >  
 >  RunAtLoad
 >  

 >  
 >  
 >
 >
 > but I'm not sure I can do that, and I have 2 programs to run for
my  
 > project, so would I create 3 entries like so :
 >
 >  
 >  
 >  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">;
 >  
 > 
 >  
 >  Label
 >  com.example.virtualenv
 >  Program
 >  source
 >  ProgramArguments
 >  
 >  /path/to/myvirtualenv/bin/activate
 >  
 >  RunAtLoad
 >  

 >  
 > 
 >  
 >  Label
 >  com.example.app1
 >  Program
 >  python
 >  ProgramArguments
 >  
 >  /path/to/myproj/launcher.py
 >  app1
 >  start
 >  
 >  RunAtLoad
 >  

 >  
 > 
 >  
 >  Label
 >  com.example.app2
 >  Program
 >  python
 >  ProgramArguments
 >  
 >  /path/to/myproj/launcher.py
 >  app2
 >  start
 >  
 >  RunAtLoad
 >  

 >  
 >  
 >
 > Or is there a better/another way to do this?
 > _______________________________________________
 > Pythonmac-SIG maillist  -  
 > http://mail.python.org/mailman/listinfo/pythonmac-sig
 

Links:
------
[1] http://www.apple.com/DTDs/PropertyList-1.0.dtd%26quot%3B%26gt
[2] http://www.apple.com/DTDs/PropertyList-1.0.dtd%26quot%3B%26gt
[4] http://mail.python.org/mailman/listinfo/pythonmac-sig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20090925/2747d8d6/attachment-0001.htm>


More information about the Pythonmac-SIG mailing list