Skip to content

Commit 45fa572

Browse files
committed
Registration/bugfix: "Edit with Spyder" was sometimes crashing due to the fact
that the environment was not configured as in WinPython installation.
1 parent 3b61bc5 commit 45fa572

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

winpython/associate.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ def register(target, current=True):
7474
# Verbs
7575
python = osp.abspath(osp.join(target, 'python.exe'))
7676
pythonw = osp.abspath(osp.join(target, 'pythonw.exe'))
77+
spyder = osp.abspath(osp.join(target, os.pardir, 'Spyder.exe'))
78+
if not osp.isfile(spyder):
79+
spyder = '%s" "%s\Scripts\spyder' % (pythonw, target)
7780
winreg.SetValueEx(winreg.CreateKey(root, KEY_C2 % ("", "open")),
7881
"", 0, winreg.REG_SZ, '"%s" "%%1" %%*' % python)
7982
winreg.SetValueEx(winreg.CreateKey(root, KEY_C2 % ("NoCon", "open")),
@@ -89,11 +92,9 @@ def register(target, current=True):
8992
'"%s" "%s\Lib\idlelib\idle.pyw" -n -e "%%1"'
9093
% (pythonw, target))
9194
winreg.SetValueEx(winreg.CreateKey(root, KEY_C2 % ("", EWS)),
92-
"", 0, winreg.REG_SZ,
93-
'"%s" "%s\Scripts\spyder" "%%1"' % (pythonw, target))
95+
"", 0, winreg.REG_SZ, '"%s" "%%1"' % spyder)
9496
winreg.SetValueEx(winreg.CreateKey(root, KEY_C2 % ("NoCon", EWS)),
95-
"", 0, winreg.REG_SZ,
96-
'"%s" "%s\Scripts\spyder" "%%1"' % (pythonw, target))
97+
"", 0, winreg.REG_SZ, '"%s" "%%1"' % spyder)
9798

9899
# Drop support
99100
handler = "{60254CA5-953B-11CF-8C96-00AA00B8708C}"

0 commit comments

Comments
 (0)