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


Groups > comp.lang.python > #93048

Re: Python File as the Default PDF handler for Windows

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: Python File as the Default PDF handler for Windows
Date 2015-06-23 16:12 -0400
Organization IISS Elusive Unicorn
References <2bba2e7f-ef41-4b08-8768-fa154c219042@googlegroups.com> <863086551.5226529.1435069587998.JavaMail.root@sequans.com>
Newsgroups comp.lang.python
Message-ID <mailman.734.1435090373.13271.python-list@python.org> (permalink)

Show all headers | View raw


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).
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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