Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #93050

Re: Python File as the Default PDF handler for Windows

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'handler': 0.04; 'subject:Python': 0.05; 'from:addr:yahoo.co.uk': 0.05; '(so': 0.07; 'executable': 0.07; 'subject:Windows': 0.09; 'interpreter,': 0.09; 'path.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'itself.': 0.11; 'skip:p 40': 0.15; '"file': 0.16; '.py': 0.16; 'chris,': 0.16; 'executable.': 0.16; 'placeholder': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:File': 0.16; 'wrote:': 0.16; 'language': 0.19; '>>>': 0.20; 'windows': 0.20; '+0200': 0.20; 'extension': 0.20; 'arguments': 0.22; 'install,': 0.22; 'lawrence': 0.22; '2015': 0.23; "i've": 0.24; 'header:In-Reply-To:1': 0.24; 'script': 0.25; 'header:User-Agent:1': 0.26; 'installed': 0.26; 'header:X -Complaints-To:1': 0.26; 'specify': 0.27; "i'm": 0.29; 'complain': 0.29; 'correct,': 0.29; 'itself,': 0.29; '(c)': 0.29; 'skip:p 30': 0.32; 'probably': 0.32; 'language.': 0.32; 'skip:. 10': 0.32; '2009': 0.34; 'file': 0.34; 'add': 0.34; 'skip:c 30': 0.35; 'to:addr:python-list': 0.35; 'path': 0.35; 'skip:. 20': 0.35; 'something': 0.35; 'but': 0.36; 'two': 0.37; "didn't": 0.37; 'subject:: ': 0.37; 'pdf': 0.37; 'tue,': 0.38; 'received:org': 0.38; 'names': 0.38; 'files': 0.38; 'to:addr:python.org': 0.39; 'mark': 0.40; 'subject:the': 0.40; "you've": 0.61; 'expert': 0.63; 'different': 0.64; 'our': 0.64; 'charset:windows-1252': 0.65; 'reserved.': 0.70; 'clicking': 0.75; '3.4': 0.84; 'pythonistas,': 0.84; 'dennis': 0.91; 'panel.': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: Python File as the Default PDF handler for Windows
Date Tue, 23 Jun 2015 21:20:21 +0100
References <2bba2e7f-ef41-4b08-8768-fa154c219042@googlegroups.com> <863086551.5226529.1435069587998.JavaMail.root@sequans.com> <h5fjoali71hjsrvs6u739kn0pukjdu4iq6@4ax.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host host-78-146-7-216.as13285.net
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
In-Reply-To <h5fjoali71hjsrvs6u739kn0pukjdu4iq6@4ax.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.735.1435090836.13271.python-list@python.org> (permalink)
Lines 55
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1435090836 news.xs4all.nl 2920 [2001:888:2000:d::a6]:34006
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:93050

Show key headers only | View raw


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 | NextPrevious in thread | Find similar | Unroll thread


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