Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!feeder.erje.net!1.eu.feeder.erje.net!bcyclone04.am1.xlned.com!bcyclone04.am1.xlned.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.05; '*not*': 0.07; 'subject:Windows': 0.09; '"%s"': 0.09; 'extension.': 0.09; 'python': 0.11; '"%s",': 0.16; 'definition.': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'looping': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'subject:File': 0.16; 'wrote:': 0.16; 'windows': 0.20; 'do.': 0.22; 'am,': 0.23; '2015': 0.23; 'passing': 0.23; "i've": 0.24; 'header:In-Reply-To:1': 0.24; 'wondering': 0.25; 'header:User- Agent:1': 0.26; 'chris': 0.26; 'there.': 0.30; '---': 0.30; 'fri,': 0.31; 'maybe': 0.31; 'run': 0.32; 'received:84': 0.32; 'file': 0.34; 'add': 0.34; "i'll": 0.34; 'to:addr:python-list': 0.35; 'path': 0.35; 'something': 0.35; 'but': 0.36; 'url:library': 0.36; 'should': 0.37; 'subject:: ': 0.37; 'missing': 0.37; 'doing': 0.38; 'end': 0.39; 'url:microsoft': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'subject:the': 0.40; 'called': 0.40; 'your': 0.60; 'simple': 0.61; 'more': 0.62; 'within': 0.64; 'url:en-us': 0.66; 'details:': 0.73; 'tomorrow,': 0.84; 'mean.': 0.91; 'reply,': 0.93 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=OoyysHLt c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=QrohdLjRRo4A:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=pGLkceISAAAA:8 a=yMhMjlubAAAA:8 a=EOkkQkx3moYwgG4J7cgA:9 a=QEXdDO2ut3YA:10 a=XYqcR7d34ucA:10 X-AUTH: mrabarnett@:2500 Date: Fri, 19 Jun 2015 02:39:58 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Python File as the Default PDF handler for Windows References: <60c5531e-b4b4-43b2-a3b9-0b53e1490dee@googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1434678004 news.xs4all.nl 2892 [2001:888:2000:d::a6]:39518 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 4391 X-Received-Body-CRC: 159208604 Xref: csiph.com comp.lang.python:92866 On 2015-06-19 02:18, Chris Angelico wrote: > On Fri, Jun 19, 2015 at 11:03 AM, Naftali 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