This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

DFU with usb-serial fails with AttributeError: 'exceptions.ImportError' object has no attribute 'strerror'

Installed nrfutil with python 3.8 and pip3 20.0.2 on Windows 10
Trying to run dfu over usb-serial:
nrfutil dfu usb-serial -pkg FW.zip -p COM4 -b 115200

I get the following error:
Traceback (most recent call last):
File "nordicsemi_main_.py", line 1464, in
File "click\core.py", line 764, in call
File "click\core.py", line 717, in main
File "click\core.py", line 1137, in invoke
File "click\core.py", line 1137, in invoke
File "click\core.py", line 956, in invoke
File "click\core.py", line 555, in invoke
File "nordicsemi_main_.py", line 1001, in usb_serial
File "nordicsemi_main_.py", line 956, in do_serial
File "nordicsemi\dfu\dfu.py", line 121, in dfu_send_images
File "nordicsemi\dfu\dfu.py", line 90, in _dfu_send_image
File "nordicsemi\dfu\dfu_transport_serial.py", line 203, in open
AttributeError: 'exceptions.ImportError' object has no attribute 'strerror'
[33728] Failed to execute script main

I find it a bit odd that I would be seeing an ImportError, and not an OSError or something that would indicate a serial failure. Unfortunately the bare except is keeping me from seeing what the offending import is.

Parents Reply Children
  • Python 3.8.1

    nrfutil version 6.0.1

    I actually had forgotten I did have multiple nrfutils installed, I just uninstalled the pip installed version and made sure I was using the standalone from the nrfutil github. The pip installed version gave me the following error:

    Traceback (most recent call last):
      File "c:\users\chris\appdata\local\programs\python\python38-32\lib\runpy.py", line 193, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "c:\users\chris\appdata\local\programs\python\python38-32\lib\runpy.py", line 86, in _run_code
        exec(code, run_globals)
      File "C:\Users\chris\AppData\Local\Programs\Python\Python38-32\Scripts\nrfutil.exe\__main__.py", line 4, in <module>
      File "c:\users\chris\appdata\local\programs\python\python38-32\lib\site-packages\nordicsemi\__main__.py", line 52, in <module>
        from nordicsemi.dfu.dfu_transport_serial import DfuTransportSerial
      File "c:\users\chris\appdata\local\programs\python\python38-32\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 46, in <module>
        from serial import Serial
    ImportError: cannot import name 'Serial' from 'serial' (c:\users\chris\appdata\local\programs\python\python38-32\lib\site-packages\serial\__init__.py)

    I am going to try using the windows exe as it at least does not throw this exception, I will report back if I have any problems. 

Related