summaryrefslogtreecommitdiffstats
path: root/Obok_plugin
diff options
context:
space:
mode:
authorjourneyman88 <[email protected]>2021-03-01 21:15:20 +0100
committerjourneyman88 <[email protected]>2021-03-01 21:15:20 +0100
commitecc7db09a9e3bda6da79b52bc7a07d5d217fd0ce (patch)
treef5f351d804872e371d1cd2fd1e52ce5382cf2124 /Obok_plugin
parent76a47e0dd079e76ff9cf7ba3458d137ead7f8c29 (diff)
Fix in keyfetch for obok on win10
According to calibre debug the ipconfig command returned some invalid utf-8 characters (I think is maybe an issue due to the Python2 switch-off as the 4.x version worked fine). To solve this I've changed the external call and modified the regex to match both the output of "ipconfig" and that of "wmic".
Diffstat (limited to 'Obok_plugin')
-rw-r--r--Obok_plugin/obok/obok.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Obok_plugin/obok/obok.py b/Obok_plugin/obok/obok.py
index 6c43089..a00003b 100644
--- a/Obok_plugin/obok/obok.py
+++ b/Obok_plugin/obok/obok.py
@@ -470,8 +470,8 @@ class KoboLibrary(object):
"""The list of all MAC addresses on this machine."""
macaddrs = []
if sys.platform.startswith('win'):
- c = re.compile('\s(' + '[0-9a-f]{2}-' * 5 + '[0-9a-f]{2})(\s|$)', re.IGNORECASE)
- output = subprocess.Popen('ipconfig /all', shell=True, stdout=subprocess.PIPE, text=True).stdout
+ c = re.compile('\s?(' + '[0-9a-f]{2}[:\-]' * 5 + '[0-9a-f]{2})(\s|$)', re.IGNORECASE)
+ output = subprocess.Popen('wmic nic where PhysicalAdapter=True get MACAddress', shell=True, stdout=subprocess.PIPE, text=True).stdout
for line in output:
m = c.search(line)
if m: