Skip to content

Bug: Crash on ImportError: cannot import name 'ChapterOptionsDialog' #202

Description

@OpaTsupa000

I've been having crashes after reinstalling my Win11.
It took a while but I think I fixed it with the help of ClaudeAi.
Here is the context:

Bug: ImportError: cannot import name 'ChapterOptionsDialog' crashes desktop app when opening files with chapter markers (v1.3.1)

Summary

The desktop (PyQt) app crashes whenever it processes an input file containing a <<CHAPTER_MARKER:...>> tag. Files without chapter markers process normally. Root cause is a stale import path left over from the abogen.pyqt subpackage refactor.

Environment

abogen version: 1.3.1 (confirmed via pip show abogen)
OS: Windows 11
Interface: Desktop GUI (abogen.exe / abogen-pyqt.exe), not Web UI
Reproduced identically on two separate installs:
WINDOWS_INSTALL.bat → Option 1 (Stable/PyPI, embedded Python)
A clean pip install abogen into an isolated venv on a separate, independently installed Python 3.12.10

Steps to reproduce

Open any input file (e.g. .txt) containing a chapter marker, e.g.:
<<CHAPTER_MARKER:Chapter 1>>
Load it in the desktop app and click Start.
App crashes as soon as the chapter options dialog should appear.

Actual error

(Obtained by running python -X faulthandler -m abogen.pyqt.main from a terminal — the compiled .exe swallows the traceback silently, which is worth noting as a separate small issue.)

Qt Fatal: Traceback (most recent call last):
File "...\abogen\pyqt\gui.py", line 3010, in show_chapter_options_dialog
from abogen.conversion import ChapterOptionsDialog
ImportError: cannot import name 'ChapterOptionsDialog' from 'abogen.conversion'

Root cause

ChapterOptionsDialog is defined in abogen/pyqt/conversion.py (confirmed by searching the installed package), but abogen/pyqt/gui.py line 3010 imports it from abogen.conversion (missing the .pyqt segment) — a leftover from when the codebase was split into the abogen.pyqt subpackage.

Fix

In abogen/pyqt/gui.py, line 3010, change:

python
from abogen.conversion import ChapterOptionsDialog

to:

python
from abogen.pyqt.conversion import ChapterOptionsDialog

This one-line change resolves the crash completely. Verified working on both installs above after patching.

Impact

Affects any desktop-app user on 1.3.1 who processes a file containing chapter markers — a core, documented feature of the app.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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