Skip to content

[bug] ELM327 emulator crashes with AttributeError: module 'readline' has no attribute 'backend' #50

@PaulMarisOUMary

Description

@PaulMarisOUMary

Summary

When trying to run the ELM327 emulator on Windows with Python 3.13, the emulator fails with an AttributeError.

Steps to Reproduce

# 1. Create and activate virtual environment
py -3 -m venv .venv
.venv\Scripts\activate

# 2. Install ELM327-Emulator
pip install ELM327-Emulator --no-cache-dir

# 3. Run the emulator on any port
python -m elm -p COM9 -s car --baudrate 38400

Expected Behavior

The ELM327 emulator should start successfully on Windows, print the startup messages, and enter the interactive command loop without errors. Like so:

> python -m elm -p COM9 -s car --baudrate 38400
2025-09-14 15:26:51,645 - root - INFO -

ELM327 OBD-II adapter emulator v3.0.4 started on serial COM port "COM9".

Emulator scenario switched to 'car'
Welcome to the ELM327 OBD-II adapter emulator.
ELM327-emulator is running on serial COM port "COM9" with baud rate 38400.
Type help or ? to list commands.

CMD>

Actual Behavior

The emulator starts, prints the initial info, but immediately crashes with an AttributeError.

> python -m elm -p COM9 -s car --baudrate 38400
2025-09-14 15:44:51,700 - root - INFO - 

ELM327 OBD-II adapter emulator v3.0.4 started on serial COM port "COM9".

Emulator scenario switched to 'car'
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\username\Desktop\playground\.venv\Lib\site-packages\elm\__main__.py", line 18, in <module>   
    main()
    ~~~~^^
  File "C:\Users\username\Desktop\playground\.venv\Lib\site-packages\elm\interpreter.py", line 1280, in main  
    p_elm.cmdloop_with_keyboard_interrupt(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        'Welcome to the ELM327 OBD-II adapter emulator.\n'
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        'ELM327-emulator is running on %s\n'
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        'Type help or ? to list commands.\n' % pty_name
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "C:\Users\username\Desktop\playground\.venv\Lib\site-packages\elm\interpreter.py", line 951, in cmdloop_with_keyboard_interrupt
    self.cmdloop(arg)
    ~~~~~~~~~~~~^^^^^
  File "C:\Program Files\Python313\Lib\cmd.py", line 111, in cmdloop
    if readline.backend == "editline":
       ^^^^^^^^^^^^^^^^
AttributeError: module 'readline' has no attribute 'backend'

Environment

  • Operating System: Windows 10 Pro, version 10.0.19045 N/A build 19045
  • Python Version: Python 3.13.4 (on virtual environment)
  • Install Method: pip install ELM327-Emulator --no-cache-dir
  • Installed packages:
> pip freeze
ELM327-emulator==3.0.4
flexcache==0.3
flexparser==0.4
lockfile==0.12.2
obd==0.7.3
Pint==0.24.4
platformdirs==4.4.0
pyreadline3==3.5.4
pyserial==3.5
python-daemon==3.1.2
PyYAML==6.0.2
typing_extensions==4.15.0

Traceback

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\username\Desktop\playground\.venv\Lib\site-packages\elm\__main__.py", line 18, in <module>   
    main()
    ~~~~^^
  File "C:\Users\username\Desktop\playground\.venv\Lib\site-packages\elm\interpreter.py", line 1280, in main  
    p_elm.cmdloop_with_keyboard_interrupt(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        'Welcome to the ELM327 OBD-II adapter emulator.\n'
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        'ELM327-emulator is running on %s\n'
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        'Type help or ? to list commands.\n' % pty_name
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "C:\Users\username\Desktop\playground\.venv\Lib\site-packages\elm\interpreter.py", line 951, in cmdloop_with_keyboard_interrupt
    self.cmdloop(arg)
    ~~~~~~~~~~~~^^^^^
  File "C:\Program Files\Python313\Lib\cmd.py", line 111, in cmdloop
    if readline.backend == "editline":
       ^^^^^^^^^^^^^^^^
AttributeError: module 'readline' has no attribute 'backend'

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions