Opened 14 years ago

Closed 14 years ago

#8917 closed defect (Invalid)

Jamu script crashes in dutch locale

Reported by: launchpad@… Owned by: robertm
Priority: minor Milestone: unknown
Component: Plugin - MythVideo Version: 0.23.1
Severity: medium Keywords: jamu
Cc: Ticket locked: no

Description

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

Change History (1)

comment:1 Changed 14 years ago by robertm

Resolution: Invalid
Status: newclosed

Jamu must be run in a correct UTF-8 locale to support UTF-8 characters and numbering. It's in the instructions.

Note: See TracTickets for help on using tickets.