Python File as the Default PDF handler for Windows

MRAB python at mrabarnett.plus.com
Thu Jun 18 21:39:58 EDT 2015


On 2015-06-19 02:18, Chris Angelico wrote:
> 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.
>
I don't think it should be "%s", but "%*".

This has more details:

https://technet.microsoft.com/en-us/library/bb490912.aspx




More information about the Python-list mailing list