Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #93050
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Subject | Re: Python File as the Default PDF handler for Windows |
| Date | 2015-06-23 21:20 +0100 |
| References | <2bba2e7f-ef41-4b08-8768-fa154c219042@googlegroups.com> <863086551.5226529.1435069587998.JavaMail.root@sequans.com> <h5fjoali71hjsrvs6u739kn0pukjdu4iq6@4ax.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.735.1435090836.13271.python-list@python.org> (permalink) |
On 23/06/2015 21:12, Dennis Lee Bieber wrote: > On Tue, 23 Jun 2015 16:26:28 +0200 (CEST), Jean-Michel Pichavant > <jeanmichel@sequans.com> declaimed the following: > >>> Just to update, you are correct, Chris, the file short name is passed >>> into sys.argv. didn't need to add anything to the path. But a gotcha >>> -- Windows didn't like my .py, clicking on the pdf causes Windows to >>> complain about 'file x' is not a valid windows executable. >> >> I'm not an expert of windows but you probably need to specify the python interpreter, not the script itself. >> >> something like >> >> C:\Python2.7\python.exe yourscript.py %* >> >> in the windows file association panel. >> > Need to check the specific install, I've seen two or three different > assoc names used in the past... > > Microsoft Windows [Version 6.1.7601] > Copyright (c) 2009 Microsoft Corporation. All rights reserved. > > C:\Users\Wulfraed\Documents>assoc .py > .py=Python.File > > C:\Users\Wulfraed\Documents>ftype python.file > python.file="C:\Python_x64\Python27\python.exe" "%1" %* > > ftype links a "file type" handler to the executable path (note the "%1" > is the placeholder for the script name itself, and arguments to the script > are collected with %*). Assoc then links the extension to the handler (so > you can also assoc .pyc files to the same interpreter). > With Python 3.4 or if you've installed the pylauncher independantly. C:\Users\Mark\Documents\MyPython>assoc .py .py=Python.File C:\Users\Mark\Documents\MyPython>ftype python.file python.file="C:\Windows\py.exe" "%1" %* C:\Users\Mark\Documents\MyPython>assoc .pyw .pyw=Python.NoConFile C:\Users\Mark\Documents\MyPython>ftype python.noconfile python.noconfile="C:\Windows\pyw.exe" "%1" %* -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Python File as the Default PDF handler for Windows Naftali <nmichalowsky@gmail.com> - 2015-06-18 14:04 -0700
Re: Python File as the Default PDF handler for Windows Chris Angelico <rosuav@gmail.com> - 2015-06-19 09:46 +1000
Re: Python File as the Default PDF handler for Windows Naftali <nmichalowsky@gmail.com> - 2015-06-18 18:03 -0700
Re: Python File as the Default PDF handler for Windows Chris Angelico <rosuav@gmail.com> - 2015-06-19 11:18 +1000
Re: Python File as the Default PDF handler for Windows MRAB <python@mrabarnett.plus.com> - 2015-06-19 02:39 +0100
Re: Python File as the Default PDF handler for Windows Chris Angelico <rosuav@gmail.com> - 2015-06-19 11:46 +1000
Re: Python File as the Default PDF handler for Windows Naftali <nmichalowsky@gmail.com> - 2015-06-18 18:22 -0700
Re: Python File as the Default PDF handler for Windows Naftali <nmichalowsky@gmail.com> - 2015-06-23 06:39 -0700
Re: Python File as the Default PDF handler for Windows Chris Angelico <rosuav@gmail.com> - 2015-06-24 01:00 +1000
Re: Python File as the Default PDF handler for Windows Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-06-23 16:12 -0400
Re: Python File as the Default PDF handler for Windows Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-23 21:20 +0100
csiph-web