Skip to content

Commit 2ee8bb6

Browse files
committed
encode help URL in windows to avoid webbrowser module from eating the pound sign
1 parent 95ee354 commit 2ee8bb6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

GSASII/GSASIIctrlGUI.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7691,6 +7691,15 @@ def ShowHelp(helpType,frame,helpMode=None):
76917691
helplink = os.path.join(path2GSAS2,'help',helplink)
76927692
pfx = "file://"
76937693
if sys.platform.lower().startswith('win'):
7694+
# really don't understand what urlunsplit is doing, but this seems
7695+
# to prevent windows from encoding the # for the anchor
7696+
# (suggested by Google's AI!)
7697+
from urllib.parse import urlunsplit
7698+
f = helplink.split('#')[0]
7699+
a = ''
7700+
if '#' in helplink:
7701+
a = helplink.split('#')[1]
7702+
helplink = urlunsplit(['file','',f,'',a])
76947703
pfx = ''
76957704
#if GSASIIpath.GetConfigValue('debug'): print 'DBG_Help link=',pfx+helplink
76967705
if htmlFirstUse:

0 commit comments

Comments
 (0)