Author steve.dower
Recipients eryksun, jeff.allen, mark, ned.deily, rhettinger, serhiy.storchaka, steve.dower, terry.reedy
Date 2018-11-19.23:40:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1542670821.29.0.788709270274.issue22121@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-11-19 23:40:21steve.dowersetrecipients: + steve.dower, rhettinger, terry.reedy, mark, ned.deily, serhiy.storchaka, jeff.allen, eryksun
2018-11-19 23:40:21steve.dowersetmessageid: <1542670821.29.0.788709270274.issue22121@psf.upfronthosting.co.za>
2018-11-19 23:40:21steve.dowerlinkissue22121 messages
2018-11-19 23:40:21steve.dowercreate