[Tutor] droplet like behaviour in Python

Nick Raptis airscorp at otenet.gr
Tue Aug 11 23:49:57 CEST 2009


For the Windows users out there:

A google search returned me this:
Make Python Scripts Droppable in Windows 
<http://mindlesstechnology.wordpress.com/2008/03/29/make-python-scripts-droppable-in-windows/>

I checked my registry and the extension was there. That must be why my 
drop script works.
No idea how it got there though. FWIW, I have installed Python through 
the .msi installer.

PS: What I like is that the page I linked actually has my little test 
script in it :D
       I must be doing something right.

PS2: I guess I'm starting to deduce that the answer is 
platform/installation specific rather than python/script specific.
        That turns the question it to a whole new direction for me.

Nick

Nick Raptis wrote:
> pedro wrote:
>>
>> #!/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
>>
>>
>
> Pedro, I'll reply to this message instead of the last one because, I 
> actually tried the little script you have there, and it does work
> I'm on Windows though.
>
> Well, my version of your script is this:
> -------------------------
> import sys
> for arg in sys.argv:
>    print arg
>
> raw_input()
> -------------------------
>
> The raw_input() at the end is what keeps the window open so I can see 
> that something really happened before the window closed.
> When I drop a file into my script, it prints two lines: The script 
> filename and the filename of the file I dropped.
> So I call it a win.
>
> I don't know how it behaves in mac, but please try and tell. (Also put 
> your usual #!/usr/bin/env python in there to work for you)
>
> Nick
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>


More information about the Tutor mailing list