Skip to content

gh-95841: IDLE - Revise Windows local doc url #95845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 11, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions Lib/idlelib/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import tokenize
import traceback
import webbrowser
import winreg

from tkinter import *
from tkinter.font import Font
Expand Down Expand Up @@ -86,10 +87,19 @@ def __init__(self, flist=None, filename=None, key=None, root=None):
dochome = os.path.join(basepath, pyver,
'Doc', 'index.html')
elif sys.platform[:3] == 'win':
chmfile = os.path.join(sys.base_prefix, 'Doc',
'Python%s.chm' % _sphinx_version())
if os.path.isfile(chmfile):
dochome = chmfile
docfile = "Dummy^file&name*that(should)fail-isfile#check"
KEY = (rf"Software\Python\PythonCore\{sys.winver}"
r"\Help\Main Python Documentation")
try:
docfile = winreg.QueryValue(winreg.HKEY_CURRENT_USER, KEY)
except FileNotFoundError:
try:
docfile = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE,
KEY)
except FileNotFoundError:
pass
if os.path.isfile(docfile):
dochome = docfile
elif sys.platform == 'darwin':
# documentation may be stored inside a python framework
dochome = os.path.join(sys.base_prefix,
Expand Down