Message264315
I have found that the execution of python scripts is inconsistent from the following methods:
From Explorer:
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>
5) <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.
#22121
#25450
Some digging found this registry entry which may be relevant.
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.py |
|
Date |
User |
Action |
Args |
2016-04-26 16:01:58 | busfault | set | recipients:
+ busfault, paul.moore, tim.golden, zach.ware, steve.dower |
2016-04-26 16:01:58 | busfault | set | messageid: <1461686518.69.0.791676363676.issue26866@psf.upfronthosting.co.za> |
2016-04-26 16:01:58 | busfault | link | issue26866 messages |
2016-04-26 16:01:58 | busfault | create | |
|