[New-bugs-announce] [issue26866] Inconsistent environment in Windows using "Open With"
report at bugs.python.org
Tue Apr 26 12:01:58 EDT 2016
New submission from Tom Middleton:
I have found that the execution of python scripts is inconsistent from the following methods:
1) Right-Click->Open with->python.exe
2) Right-Click->Open (assuming python.exe being the "default" application)
3) Right-Click->Open with->"Choose default program..."->python.exe
4) Double-Click the script
from the command prompt:
4) python <scriptname>
Of those listed, #1 opens the script with the CWD as c:\Windows\System32\
The remainder open the script with the CWD (as from os.getcwd()) as the current directory of the executed script.
The issue arose when attempting to open a file in the same directory as the script. The issue of how to access a file in the same directory as the script isn't the point of this issue however it is that it is inconsistent across methods that would seem to be identical to the user.
A use case for Open with->python.exe is if say you want your default behavior to be open with an IDE.
The following other issues I found may be relevant.
Some digging found this registry entry which may be relevant.
components: Installation, Windows
nosy: busfault, paul.moore, steve.dower, tim.golden, zach.ware
title: Inconsistent environment in Windows using "Open With"
versions: Python 2.7
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce