[Tutor] droplet like behaviour in Python

pedro pedrooconnell at gmail.com
Mon Aug 10 02:58:17 CEST 2009


On 2009-08-08 19:34:44 -0400, "Alan Gauld" <alan.gauld at btinternet.com> said:

> 
> "pedro" <pedrooconnell at gmail.com> wrote
> 
> 
>> 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]
> 
> I may be wrong but I thought that, provided you had the path and
> shebang etc set up properly that it just happened. Have you tried
> a simpe script that just prints argv say?

Well I made a script called droplet.py which looks like this:

#!/usr/bin/env python
# encoding: utf-8
import sys
theFilePath = sys.argv[1]
print theFilePath


But when I try to drop something on it nothing happens. Sorry I guess 
there is something fundamental that I am missing.
Pete








More information about the Tutor mailing list