NordicSemiconductor / pynrfjprog

Python wrapper around the nrfjprog dynamic link library (DLL)
Other
74 stars 26 forks source link

error "\\\\"in win10 20H2 #15

Closed em78p153s closed 3 years ago

em78p153s commented 3 years ago

The following error occurred with this script in the windows system:

Windows 10
20H2
‎2020/‎11/‎16
19042.630

C:\Users\Peter\Desktop\modem>python update.py mfw_nrf9160_1.2.0.zip INFO:modem_update:Modem firmware upgrade ERROR:pynrfjprog.HighLevel:b'An error was reported by NRFJPROG DLL: -151 NRFJPROG_SUB_DLL_COULD_NOT_BE_OPENED. Got error FileNotFoundError("Could not find module \'C:\\Program Files\\Python38\\lib\\site-packages\\pynrfjprog\\lib_x64\\highlevelnrfjprog.dll\'. Try using the full path with constructor syntax.") for library at C:\Program Files\Python38\lib\site-packages\pynrfjprog\lib_x64\highlevelnrfjprog.dll' Traceback (most recent call last): File "C:\Program Files\Python38\lib\site-packages\pynrfjprog\HighLevel.py", line 77, in init self.lib = ctypes.cdll.LoadLibrary(highlevel_nrfjprog_dll_path) File "C:\Program Files\Python38\lib\ctypes__init__.py", line 451, in LoadLibrary return self._dlltype(name) File "C:\Program Files\Python38\lib\ctypes__init.py", line 373, in init__ self._handle = _dlopen(self._name, mode) FileNotFoundError: Could not find module 'C:\Program Files\Python38\lib\site-packages\pynrfjprog\lib_x64\highlevelnrfjprog.dll'. Try using the full path with constructor syntax.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "update.py", line 45, in main() File "update.py", line 42, in main flash_modem_pkg(args.modem_pkg,True) File "update.py", line 21, in flash_modem_pkg with HighLevel.API(True) as api: File "C:\Program Files\Python38\lib\site-packages\pynrfjprog\HighLevel.py", line 79, in init raise APIError(NrfjprogdllErr.NRFJPROG_SUB_DLL_COULD_NOT_BE_OPENED, 'Got error {} for library at {}'.format(repr(ex), highlevel_nrfjprog_dll_path), log=self._logger.error) pynrfjprog.APIError.APIError: An error was reported by NRFJPROG DLL: -151 NRFJPROG_SUB_DLL_COULD_NOT_BE_OPENED. Got error FileNotFoundError("Could not find module 'C:\Program Files\Python38\lib\site-packages\pynrfjprog\lib_x64\highlevelnrfjprog.dll'. Try using the full path with constructor syntax.") for library at C:\Program Files\Python38\lib\site-packages\pynrfjprog\lib_x64\highlevelnrfjprog.dll

C:\Users\Peter\Desktop\modem>pause

0 1

simtind commented 3 years ago

In which version of pynrfjprog were you seeing this issue?

simtind commented 3 years ago

This looks like a change in behavior for Python 3.8 that I'm surprised we haven't encountered ourselves. Root cause is that CTypes now doesn't consider the full path as a full path any more, leading to the dll load failing with a weird error message. Python issue regarding the documentation that may provide some context as to why this is a problem: https://bugs.python.org/issue42114

Will follow up internally.

em78p153s commented 3 years ago

The version of pynrfjprog is here:

------------------ 原始邮件 ------------------ 发件人: "NordicSemiconductor/pynrfjprog" <notifications@github.com>; 发送时间: 2021年2月12日(星期五) 晚上10:43 收件人: "NordicSemiconductor/pynrfjprog"<pynrfjprog@noreply.github.com>; 抄送: "I believe"<em78p153s@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [NordicSemiconductor/pynrfjprog] error "\\"in win10 20H2 (#15)

In which version of pynrfjprog were you seeing this issue?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

em78p153s commented 3 years ago
  1. This problem was discovered mainly because a new operating system was replaced.

  2. The new operating system version is:

  3. Run this script directly to re-create the problem: python update.py mfw_nrf9160_1.2.0.zip

  4. Installing this pack directly will solve the problem: DirectX Repair V3.9

------------------ 原始邮件 ------------------ 发件人: "NordicSemiconductor/pynrfjprog" <notifications@github.com>; 发送时间: 2021年2月12日(星期五) 晚上10:50 收件人: "NordicSemiconductor/pynrfjprog"<pynrfjprog@noreply.github.com>; 抄送: "I believe"<em78p153s@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [NordicSemiconductor/pynrfjprog] error "\\"in win10 20H2 (#15)

This looks like a change in behavior for Python 3.8 that I'm surprised we haven't encountered ourselves. Root cause is that CTypes now doesn't consider the full path as a full path any more, leading to the dll load failing with a weird error message. Python issue regarding the documentation that may provide some context as to why this is a problem: https://bugs.python.org/issue42114

Will follow up internally.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

em78p153s commented 3 years ago

https://devzone.nordicsemi.com/f/nordic-q-a/68389/pynrfjprog-path-on-windows-20h2-system-please-fix-this-bug

------------------ 原始邮件 ------------------ 发件人: "Simen August Tinderholt"<notifications@github.com>; 发送时间: 2021年2月12日(星期五) 晚上10:50 收件人: "NordicSemiconductor/pynrfjprog"<pynrfjprog@noreply.github.com>; 抄送: "I believe"<em78p153s@qq.com>; "Author"<author@noreply.github.com>; 主题: Re: [NordicSemiconductor/pynrfjprog] error "\\"in win10 20H2 (#15)

This looks like a change in behavior for Python 3.8 that I'm surprised we haven't encountered ourselves. Root cause is that CTypes now doesn't consider the full path as a full path any more, leading to the dll load failing with a weird error message. Python issue regarding the documentation that may provide some context as to why this is a problem: https://bugs.python.org/issue42114

Will follow up internally.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

simtind commented 3 years ago

Ok, that sounds like you were missing the VC redistributable then. I'm glad your problem got solved.