(Windows) "Dropping" stuff onto a Python script
Tim Golden
mail at timgolden.me.uk
Thu Nov 6 04:12:16 EST 2008
daniel.haude at googlemail.com wrote:
> Hello people,
>
> I'd like to have the functionality known from "real" executables that
> if I drag-drop a file icon on top of the app, the app starts and has
> the file's path as command-line argument.
>
> However, this doesn't seem to work with Python scripts because Windows
> sees those just as files, not apps.
>
> Can this be done?
There may be fancier ways but...
... prefix the shortcut target with the python executable:
c:\python25\python.exe myscript.py
I've just tested this with a script which does this:
<code>
import os, sys
os.startfile (sys.argv[1])
</code>
and it works ok.
TJG
More information about the Python-list
mailing list