From 79928aaa0f463c4c1b7791e487c01faddb617987 Mon Sep 17 00:00:00 2001 From: matt wilkie Date: Wed, 13 Feb 2019 23:02:27 -0800 Subject: [PATCH] fix unicode encode err; _winreg is winreg in py3 `(unicode error) 'unicodeescape' codec can't decode bytes in position...` The Windows path in example was being interpreted as a Unicode escape sequence. Leo build: 20190213230228 --- leo/core/commit_timestamp.json | 4 ++-- leo/scripts/register-leo.leox | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/leo/core/commit_timestamp.json b/leo/core/commit_timestamp.json index e418b5a285..f4a35fe34a 100644 --- a/leo/core/commit_timestamp.json +++ b/leo/core/commit_timestamp.json @@ -1,4 +1,4 @@ { - "asctime": "Mon Feb 11 14:02:48 EST 2019", - "timestamp": "20190211140248" + "asctime": "Wed Feb 13 23:02:28 PST 2019", + "timestamp": "20190213230228" } diff --git a/leo/scripts/register-leo.leox b/leo/scripts/register-leo.leox index 713935737e..4fd6a7389a 100644 --- a/leo/scripts/register-leo.leox +++ b/leo/scripts/register-leo.leox @@ -66,7 +66,7 @@ def register_leo(pyexe, launchLeo, icon): else: g.es("LeoDoc.ico not in expected location, can't continue.") #@+node:maphew.20130510011223.1646: *3* sample registry outcome -'''This is what the resulting registry key should look like, once exported from +r'''This is what the resulting registry key should look like, once exported from regedit. The translated hex code is: "d:\Python27\python.exe" "C:\Users\Matt\Dropbox\apps\leo-editor\launchLeo.py" "%1" %* @@ -100,8 +100,11 @@ regedit. The translated hex code is: # 00,72,00,5c,00,6c,00,61,00,75,00,6e,00,63,00,68,00,4c,00,65,00,6f,00,2e,00,\ # 70,00,79,00,22,00,20,00,22,00,25,00,31,00,22,00,20,00,25,00,2a,00,00,00 #@-others -from _winreg import * - +try: + from _winreg import * +except ModuleNotFoundError as err: + from winreg import * + # g.es("\n--- Running register-leo Leo script") pyexe = g.sys.executable