On 25 Σεπ 2009, at 6:31 μ.μ., gabriel.rosse...@arimaz.com wrote:

How about running the python exec directly from the virtual env :

and again it seams to work (correct me again if I messed up somewhere).

What is the advantage of using your method?

None in particular, apart from the fact that a python script can be more flexible in deciding whether to activate a virtualenv or not, or even which virtualenv. If you are certain that the virtualenv will always be at the same place, then hardcoding it into the .plist is fine.

In my case, this snippet appears in a pyobjc app, where I don't have a lot of control on which python is used (it's complicated).

Orestis


Gabriel


On Fri 25/09/09 17:01 , "Orestis Markou" ores...@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%26quot%3B %26gt">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%26quot%3B %26gt">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 - Pythonmac-SIG@python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig";>http:// mail.python.org/mailman/listinfo/pythonmac-sig



_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to