Fix crash when PyQt6 modules are partially installed#1170
Closed
Copilot wants to merge 3 commits into
Closed
Conversation
Co-authored-by: HenriWahl <2835065+HenriWahl@users.noreply.github.com>
Co-authored-by: HenriWahl <2835065+HenriWahl@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix crash in nagstamon due to missing Qt 6 Multimedia dependency
Fix crash when PyQt6 modules are partially installed
Jan 31, 2026
There was a problem hiding this comment.
Pull request overview
This PR fixes a crash that occurs when PyQt6 modules are partially installed on Debian-based systems, where PyQt6 components are distributed as separate packages with alternative dependencies.
Changes:
- Added upfront validation of all required PyQt6 modules (QtMultimedia, QtWebEngineCore, QtWebEngineWidgets, QtSvg, QtSvgWidgets) during Qt version detection
- Implemented automatic fallback to PyQt5 when any PyQt6 module is unavailable in the auto-detection path
- Added informative error message when NAGSTAMON_QT_FLAVOR environment variable forces PyQt6 but modules are missing
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Check if all required PyQt6 modules are available | ||
| # This prevents crashes when PyQt6 is partially installed | ||
| from PyQt6.QtMultimedia import QAudioOutput | ||
| from PyQt6.QtWebEngineCore import QWebEnginePage |
There was a problem hiding this comment.
Import of 'QWebEnginePage' is not used.
Suggested change
| from PyQt6.QtWebEngineCore import QWebEnginePage |
| # This prevents crashes when PyQt6 is partially installed | ||
| from PyQt6.QtMultimedia import QAudioOutput | ||
| from PyQt6.QtWebEngineCore import QWebEnginePage | ||
| from PyQt6.QtWebEngineWidgets import QWebEngineView |
There was a problem hiding this comment.
Import of 'QWebEngineView' is not used.
| from PyQt6.QtMultimedia import QAudioOutput | ||
| from PyQt6.QtWebEngineCore import QWebEnginePage | ||
| from PyQt6.QtWebEngineWidgets import QWebEngineView | ||
| from PyQt6.QtSvg import QSvgRenderer |
There was a problem hiding this comment.
Import of 'QSvgRenderer' is not used.
Suggested change
| from PyQt6.QtSvg import QSvgRenderer |
| from PyQt6.QtWebEngineCore import QWebEnginePage | ||
| from PyQt6.QtWebEngineWidgets import QWebEngineView | ||
| from PyQt6.QtSvg import QSvgRenderer | ||
| from PyQt6.QtSvgWidgets import QSvgWidget |
There was a problem hiding this comment.
Import of 'QSvgWidget' is not used.
Suggested change
| from PyQt6.QtSvgWidgets import QSvgWidget |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Nagstamon crashes with
ModuleNotFoundErrorwhen PyQt6.QtCore is available but other PyQt6 modules (QtMultimedia, QtWebEngine, QtSvg) are missing. This occurs on Debian systems where these are separate packages with alternative dependencies.Changes
Modified
Nagstamon/qui/qt.pyto check all required PyQt6 modules upfront during Qt version detection:Applied the same logic to the
NAGSTAMON_QT_FLAVORenvironment variable path with an informative error message when modules are missing.Impact
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.