[Tutor] droplet like behaviour in Python

pedro pedrooconnell at gmail.com
Sun Aug 9 00:33:13 CEST 2009


Hi I am porting some of my code over from Applescript to Python. There 
is one thing I am not really sure how to do. I want to be able to drop 
a file onto a python script (or app I guess) and have the python script 
use the path to the file that was dropped on it as sys.argv[1]

In applescript it looks like this:
on open theNukeScript
	tell application "Terminal"
		activate
	tell application "Terminal"
			do script "python 
/Volumes/rugged/programming/python/bin/nkDoesFileExist.py " & 
theNukeScript
--etc....

Where theNukeScript is the path to of the file that was dropped. I am 
hoping to make the code cross platform.
Any advice would be greatly appreciated.
Pete




More information about the Tutor mailing list