﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	mlocked
8917	Jamu script crashes in dutch locale	launchpad@…	robertm	"I get the following error whenever the jamy.py script is run by a cron job:

Traceback (most recent call last):
  File ""/usr/share/mythtv/mythvideo/scripts/jamu.py"", line 6435, in <module> main()
  File ""/usr/share/mythtv/mythvideo/scripts/jamu.py"", line 6420, in main process.processMythTvMetaData()
  File ""/usr/share/mythtv/mythvideo/scripts/jamu.py"", line 5588, in processMythTvMetaData
    self._downloadScheduledRecordedGraphics()
  File ""/usr/share/mythtv/mythvideo/scripts/jamu.py"", line 5235, in _downloadScheduledRecordedGraphics
    programs = self._getScheduledRecordedProgramList()
  File ""/usr/share/mythtv/mythvideo/scripts/jamu.py"", line 5051, in _getScheduledRecordedProgramList
    recordedlist = MythBE(backend=mythbeconn.hostname, db=mythbeconn.db).getRecordings()
  File ""/usr/lib/python2.6/site-packages/MythTV/MythFunc.py"", line 325, in getRecordings
    + PROGRAM_FIELDS], db=self.db))
  File ""/usr/lib/python2.6/site-packages/MythTV/MythData.py"", line 444, in __init__
    DictData.__init__(self, raw)
  File ""/usr/lib/python2.6/site-packages/MythTV/MythBase.py"", line 166, in __init__
    self.data.update(self._process(raw))
  File ""/usr/lib/python2.6/site-packages/MythTV/MythBase.py"", line 178, in _process data[i] = locale.atof(data[i])
  File ""/usr/lib/python2.6/locale.py"", line 292, in atof
    return func(string)
ValueError: invalid literal for float(): 0,000000

I managed to solve this by exporting a locale in the mythvideo cron scripts:


#!/bin/sh
#Hourly massive update to ensure users see graphics coming in for upcoming recordings and current recordings
DIRECTORY=$(grep ^mythtv /etc/passwd | awk -F : '{print $6}')
if [ -f ""$DIRECTORY/.mythtv/config.xml"" ]; then
    su mythtv -c ""export locale=nl_NL.UTF-8; /usr/bin/python /usr/share/mythtv/mythvideo/scripts/jamu.py -MW >> '/var/log/mythtv/jamu.log'""
#    su mythtv -c ""/home/mythtv/jamu >> '/var/log/mythtv/jamu.log'""
fi

In addition, I had to insert a call to locale.resetlocale() into the main() method of jamu.py:

def main():
    """"""Support jamu from the command line
    returns True
    """"""
    locale.resetlocale()

    parser = OptionParser(usage=u""%prog usage: jamu -hbueviflstdnmoCRFUDSGN [parameters]\n <series name/SID or 'series/SID and season number' or 'series/SID and season number and episode number' or 'series/SID and episode name' or video file/directory paired with destination directory'>"")

I'm not a python expert, so maybe there are better ways to solve the problem. But maybe you can use this.

Cheers,

Paul"	defect	closed	minor	unknown	Plugin - MythVideo	0.23.1	medium	Invalid	jamu		0
