Opened 6 years ago

Closed 6 years ago

#12520 closed Patch - Bug Fix (Fixed)

MythArchive stops after trying to get details from database

Reported by: Ben Klopfenstein <benklop@…> Owned by: Karl Egly
Priority: minor Milestone: 0.28
Component: Plugin - MythArchive Version: Unspecified
Severity: medium Keywords: backtrace
Cc: Ticket locked: no


MythArchive?'s python script, mythburn, fails when running with the following backtrace:

reborn ~ # /usr/share/mythtv/mytharchive/scripts/
Using simple_fix_rtl (0.1.20131119-1) starting up...
script path:/usr/share/mythtv/mytharchive/scripts
myth share path:/usr/share/mythtv
Found 6 CPUs
Obtaining MythTV settings from MySQL database for hostname MythTV-Frontend
Traceback (most recent call last):
  File "/usr/share/mythtv/mytharchive/scripts/", line 5298, in <module>
  File "/usr/share/mythtv/mytharchive/scripts/", line 5165, in main
    defaultsettings = getDefaultParametersFromMythTVDB()
  File "/usr/share/mythtv/mytharchive/scripts/", line 883, in getDefaultParametersFromMythTVDB
    cursor.execute(sqlstatement, configHostname)
  File "/usr/lib64/python2.7/site-packages/MythTV/", line 71, in execute
    raise MythDBError(MythDBError.DB_RAW, e.args)
MythTV.exceptions.MythDBError: MySQL error: not all arguments converted during string formatting

This seems to be due to string formatting not working correctly for the hostname. I have submitted a PR in github with the fix - - this allows proper operation, at least for me.

Patch diff (from the PR linked above):

diff --git a/mythplugins/mytharchive/mythburn/scripts/ b/mythplugins/mytharchive/mythburn/scripts/
index ccd9861..73b65ec 100755
--- a/mythplugins/mytharchive/mythburn/scripts/
+++ b/mythplugins/mytharchive/mythburn/scripts/
@@ -846,7 +846,7 @@ def getDefaultParametersFromMythTVDB():
-                    OR (hostname=%s AND value IN(
+                    OR (hostname='{0}' AND value IN(
@@ -880,7 +880,7 @@ def getDefaultParametersFromMythTVDB():
     # create a cursor
     cursor = DB.cursor()
     # execute SQL statement
-    cursor.execute(sqlstatement, configHostname)
+    cursor.execute(sqlstatement.format(configHostname))
     # get the resultset as a tuple
     result = cursor.fetchall()

Change History (5)

comment:1 Changed 6 years ago by J.Pilk@…

This looks very similar to[[BR]]

(which is buried in a long thread; firefox takes me first to the start-of-thread)

I've been using that patch since Jaska first suggested it - although I never saw the original problem.

For convenience, here it is:

And here is the fix: File: line: 883 Change line from:

cursor.execute(sqlstatement, configHostname)


cursor.execute(sqlstatement, (configHostname,))

MySQLdb requires that parameters are passed as a sequence:

comment:2 Changed 6 years ago by Ben Klopfenstein <benklop@…>

Is the fix you mentioned in a ticket somewhere or to be included in the repository at some point?

I've updated by linked PR to fix this the way you describe.

comment:3 Changed 6 years ago by J.Pilk@…

I haven't seen it anywhere else, and a quick search shows that Jaska's other 8 posts on the user list date from 2008 or earlier.

comment:4 Changed 6 years ago by Karl Egly

Milestone: unknown0.28
Owner: set to Karl Egly
Status: newaccepted
Type: Bug Report - CrashPatch - Bug Fix

thank you for the contribution, fixed in 9ce6aaa2f08d57a86068e65c6078492b03880b23

comment:5 Changed 6 years ago by Karl Egly

Resolution: Fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.