Steve Dower <steve.do...@python.org> added the comment:

AFAICT, the best logic is this:

if os.path.normcase(os.getcwd()) == os.path.normcase(sys.prefix):
    os.chdir(get_default_location(sys.platform))

The only complexity is likely to be that "Documents" is localized on Windows, 
and SHGetFolderPathW [1] requires ctypes, though I wouldn't be surprised if 
there's a hidden English link available. There might be some trick necessary 
for macOS too. All the command line options will work for now, but will break 
in the future.

[1]: 
https://docs.microsoft.com/en-us/windows/desktop/api/shlobj_core/nf-shlobj_core-shgetfolderpathw

It's not real obvious, but when https://bugs.python.org/issue34977 lands - 
soon! - we'll get good PATH support back, including for Idle. This means you'll 
get "idle[3[.y]].exe" available globally that will do the same thing as the 
icon in Start. In this situation, the logic above is the _only_ option that 
will work properly, as there are no arguments we can pass. So forcing the CWD 
out of the install directory but otherwise leaving it alone is the best option.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue22121>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to