Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

HiRez

macrumors 603
Original poster
Jan 6, 2004
6,250
2,576
Western US
Hi, I know this is kind of obscure, but I'm trying to figure out how to launch an external application/process from Python code. Specifically, I'm trying to launch After Effects. Then, I want to be able to send a script (Javascipt) to it. Ideally, I'd like to do it directly from Python, using no additional frameworks such as PyObj, which seems quite heavyweight for what I need. A cursory Google search didn't reveal exactly what I was looking for. Is there some Python package that handles this stuff or do I have to maybe use an AppleScript bridge or something? Thanks in advance if you can help.
 

therevolution

macrumors 6502
May 12, 2003
468
0
My first idea would be to use AppleScript via the 'osascript' command line utility. I'm not exactly sure how to execute system commands in Python, maybe os.system? Google should be able to help if needed.
 

pip11

macrumors member
Apr 29, 2005
40
0
Appscript is a quite pleasant way to get to AppleScript from Python apps. The syntax is kind of reversed compared to regular AppleScript, but it works well, and you could start an app by sending a message to the Finder I think
 

IscariotJ

macrumors 6502a
Jan 13, 2004
637
66
UK
Depends on which version of Python you are using. If you're using the 2.3 ( bundled with OSX ), you need be looking at the various os.open/exec calls. If you've installed 2.5, have a look at the subprocess module.
 

HiRez

macrumors 603
Original poster
Jan 6, 2004
6,250
2,576
Western US
Thanks for the suggestions, I'll check them out when I get time, hopefully this weekend. I know there's got to be some easy way to do this, prolly multiple ways.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.