Python File as the Default PDF handler for Windows

Chris Angelico rosuav at gmail.com
Thu Jun 18 21:18:10 EDT 2015


On Fri, Jun 19, 2015 at 11:03 AM, Naftali <nmichalowsky at gmail.com> wrote:
> I may be missing something in your reply, but I am *not* wondering how to associate python with the .pdf file extension. That I know how to do. What I want to know is how from within the program that I've told windows to run when the user clicks on the file --- how to access the file that the user wishes to open. Windows must somehow make that available to my program. How to I access it. Tomorrow, I'll try doing it an looping through the sys.argvs and see what's there. maybe it's a simple as passing a path into the called program.
>

Oh! I see what you mean. You should get the full path and name of the
file in sys.argv, but if you don't, I think what you need to do is add
"%s" to the end of the association definition. My apologies for the
prior misunderstanding.

ChrisA



More information about the Python-list mailing list