Description
bauh fails to start on Python 3.14 due to two compatibility issues.
Environment
- OS: Manjaro Linux
- Python: 3.14.2
- bauh version: 0.10.8
Issue 1: pkgutil.find_loader() removed in Python 3.12+
Error
Traceback (most recent call last):
File "/usr/bin/bauh", line 8, in <module>
sys.exit(main())
File "/usr/lib/python3.14/site-packages/bauh/app.py", line 64, in main
app, widget = new_manage_panel(args, app_config, logger)
File "/usr/lib/python3.14/site-packages/bauh/manage.py", line 53, in new_manage_panel
managers = gems.load_managers(...)
File "/usr/lib/python3.14/site-packages/bauh/view/core/gems.py", line 52, in load_managers
loader = pkgutil.find_loader(f'bauh.gems.{f.name}.controller')
AttributeError: module 'pkgutil' has no attribute 'find_loader'
Cause
pkgutil.find_loader() was deprecated in Python 3.4 and removed in Python 3.12.
Suggested fix in bauh/view/core/gems.py
Replace:
import pkgutil
# ...
loader = pkgutil.find_loader(f'bauh.gems.{f.name}.controller')
if loader:
module = loader.load_module()
With:
import importlib
import importlib.util
# ...
spec = importlib.util.find_spec(f'bauh.gems.{f.name}.controller')
if spec:
module = importlib.import_module(f'bauh.gems.{f.name}.controller')
Issue 2: QThread destroyed while still running
After fixing Issue 1, bauh crashes when the root password dialog appears:
Error
QThread: Destroyed while thread is still running
Fatal Python error: Aborted
Thread 0x... [ValidatePasswor] (most recent call first):
<no Python frame>
Thread 0x... [Prepare] (most recent call first):
File "/usr/lib/python3.14/site-packages/bauh/view/qt/prepare.py", line 49 in ask_password
Cause
The ValidatePassword QThread in RootDialog may still be running when the dialog is closed/destroyed.
Suggested fix in bauh/view/qt/root.py
Add a closeEvent method to RootDialog class:
def closeEvent(self, event):
if self.validate_password.isRunning():
self.validate_password.wait()
super().closeEvent(event)
Both fixes have been tested and resolve the issues on Python 3.14.
Description
bauh fails to start on Python 3.14 due to two compatibility issues.
Environment
Issue 1:
pkgutil.find_loader()removed in Python 3.12+Error
Cause
pkgutil.find_loader()was deprecated in Python 3.4 and removed in Python 3.12.Suggested fix in
bauh/view/core/gems.pyReplace:
With:
Issue 2: QThread destroyed while still running
After fixing Issue 1, bauh crashes when the root password dialog appears:
Error
Cause
The
ValidatePasswordQThread inRootDialogmay still be running when the dialog is closed/destroyed.Suggested fix in
bauh/view/qt/root.pyAdd a
closeEventmethod toRootDialogclass:Both fixes have been tested and resolve the issues on Python 3.14.