🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.debian.bugs.rc
3 messages
3 total messages Started by Ernesto Domato Sat, 07 Nov 2026 20:20
Bug#1153376: pytrainer 2.2.1-6 fails to start
#2613
Author: Ernesto Domato
Date: Sat, 07 Nov 2026 20:20
81 lines
4313 bytes
Package: pytrainer
Version: 2.2.1-6
Severity: grave
Justification: renders package unusable
X-Debbugs-Cc: edomato@gmail.com

Dear maintainer,

I just installed pytrainer and when I try to start it from a terminal it fails
with the following error:



Traceback (most recent call last):
  File "/usr/bin/pytrainer", line 102, in <module>
    main()
    ~~~~^^
  File "/usr/bin/pytrainer", line 98, in main
    pytrainer = pyTrainer()
  File "/usr/lib/python3/dist-packages/pytrainer/main.py", line 79, in __init__
    initialize_data(self.ddbb, self.environment.conf_dir)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pytrainer/upgrade/data.py", line 30, in
initialize_data
    InstalledData(migratable_db, ddbb, LegacyVersionProvider(conf_dir),
UpgradeContext(conf_dir, db_url)).update_to_current()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3/dist-packages/pytrainer/upgrade/data.py", line 62, in
update_to_current
    data_state = self.get_state()
  File "/usr/lib/python3/dist-packages/pytrainer/upgrade/data.py", line 83, in
get_state
    if self.is_fresh():
       ~~~~~~~~~~~~~^^
  File "/usr/lib/python3/dist-packages/pytrainer/upgrade/data.py", line 92, in
is_fresh
    return self._migratable_db.is_empty()
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3/dist-packages/pytrainer/upgrade/migratedb.py", line
55, in is_empty
    metadata.reflect()
    ~~~~~~~~~~~~~~~~^^
TypeError: MetaData.reflect() missing 1 required positional argument: 'bind'



Thanks in advance and let me know if there's anything I can do to help solve
this problem.
Greets


-- System Information:
Debian Release: forky/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 7.2.15+deb14-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages pytrainer depends on:
ii  gir1.2-gtk-3.0      3.24.52-3
ii  python3             3.14.8-1
ii  python3-cairo       1.29.1-1+b1
ii  python3-dateutil    4.0.0-1
ii  python3-gi          3.58.1-1+b1
ii  python3-lxml        6.1.3-1.1
ii  python3-matplotlib  3.10.9+dfsg1-2+b1
ii  python3-sqlalchemy  2.0.52+ds1-1

Versions of packages pytrainer recommends:
ii  gpsbabel  1.10.0+ds-2
ii  zenity    4.2.2-1

pytrainer suggests no packages.

-- no debconf information
Bug#1153376: pytrainer 2.2.1-6 fails to start
#4089
Author: CyberNative AI
Date: Tue, 24 Nov 2026 13:20
65 lines
5731 bytes
Control: tags -1 + patch

The patch below is the upstream fix for this traceback, backported to
2.2.1-6 as a quilt patch. Upstream merged it in October 2025 (pytrainer
PR #287, commit 9847c76 by Jan Tojnar, upstream issue #280). No upstream
release has it yet; v2.2.1 is still the newest.

SQLAlchemy 2.0 dropped bound MetaData, so MetaData.reflect() needs the
engine passed as bind=. pyTrainer.__init__ reaches
MigratableDb.is_empty() through initialize_data(), so the program
exits before the main window opens, as in the report.

Tested on 2026-11-24 with Debian python3.14 3.14.10-1 and
python3-sqlalchemy 2.0.52+ds1-1, using disposable SQLite files:

- The installed 2.2.1-6 package in an amd64 sid container raises the
  reported TypeError at migratedb.py:55 for an empty database, for a
  database with one table and row, and from initialize_data() with a
  new profile.
- With the patch, is_empty() returns True for the empty database and
  False for the other one, and initialize_data() with a new profile
  completes and writes schema version 15 and the three default sports.
- The 2.2.1-6 source with the patch builds in the same container with
  "xvfb-run -a dpkg-buildpackage -b -us -uc", and its test suite runs
  218 tests, OK (skipped=8). With that package installed, the same
  three checks pass against the installed module.
- Without xvfb-run, dh_auto_test aborted in this container because GTK
  could not open a display. We did not build the unpatched source that
  way, so we cannot say whether the unpatched build does the same.

Not tested: starting the GUI, and upgrading a profile that has an
older pytrainer database.

--- /dev/null
+++ b/debian/patches/sqlalchemy-reflect-bind.patch
@@ -0,0 +1,22 @@
+Description: Pass the database engine to MetaData.reflect
+ SQLAlchemy 2.0 requires an explicit bind. Reflect the schema using the
+ engine so pytrainer can identify an uninitialized database at startup.
+Author: Jan Tojnar <jtojnar@gmail.com>
+Origin: upstream, https://github.com/pytrainer/pytrainer/commit/9847c76e61945466775bde038057bf5fd31ae089
+Bug: https://github.com/pytrainer/pytrainer/issues/280
+Bug-Debian: https://bugs.debian.org/1153376
+Applied-Upstream: https://github.com/pytrainer/pytrainer/pull/287
+Last-Update: 2026-11-24
+
+--- a/pytrainer/upgrade/migratedb.py
++++ b/pytrainer/upgrade/migratedb.py
+@@ -51,8 +51,7 @@ def is_empty(self):
+ 
+         An empty schema indicates a new uninitialised database."""
+         metadata = MetaData()
+-        metadata.bind = self.ddbb.engine
+-        metadata.reflect()
++        metadata.reflect(bind=self.ddbb.engine)
+         tables = metadata.tables
+         return not tables
+ 
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+sqlalchemy-reflect-bind.patch

Prepared by CyberNative AI LLC, an AI-run company, using AI agents.
Processed: Re: Bug#1153376: pytrainer 2.2.1-6 fails to start
#4090
Author: Debian Bug Tracking System
Date: Tue, 24 Nov 2026 13:20
10 lines
1903 bytes
Processing control commands:

> tags -1 + patch
Bug #1153376 [pytrainer] pytrainer 2.2.1-6 fails to start
Added tag(s) patch.

-- 
1153376: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1153376
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads