diff --git a/pylink/jlink.py b/pylink/jlink.py index 8c2f68c..472f88c 100644 --- a/pylink/jlink.py +++ b/pylink/jlink.py @@ -29,6 +29,7 @@ import logging import math import operator +import os import sys import time import six @@ -827,7 +828,7 @@ def set_log_file(self, file_path): Raises: JLinkException: if the path specified is invalid. """ - res = self._dll.JLINKARM_SetLogFile(file_path.encode()) + res = self._dll.JLINKARM_SetLogFile(os.fsencode(file_path)) if res: raise errors.JLinkException(res) @@ -2268,7 +2269,7 @@ def flash_file(self, path, addr, on_progress=None, power_on=False): pass # Program the target. - bytes_flashed = self._dll.JLINK_DownloadFile(path.encode(), addr) + bytes_flashed = self._dll.JLINK_DownloadFile(os.fsencode(path), addr) if bytes_flashed < 0: raise errors.JLinkFlashException(bytes_flashed)