[mythtv-users] elementary MiroBridge error

Greg Woods greg at gregandeva.net
Thu Oct 15 19:10:59 UTC 2009


On Wed, 2009-10-14 at 21:15 -0400, Doug Vaughan wrote:
=
> The statements that are giving you trouble all start with ".strftime(u'" 
> and using a text editor, you could substitute that for ".strftime('"

It is definitely a change in the "datetime" module somewhere between 2.5
and 2.6. On a Fedora 11 workstation:

$ python
Python 2.6 (r26:66714, Jun  8 2009, 16:07:26) 
[GCC 4.4.0 20090506 (Red Hat 4.4.0-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.now().strftime(u'%Y-%m-%d %H:%M:%S')
'2009-10-15 12:57:55'

On the Fedora 10 mythbackend system:

$ python
Python 2.5.2 (r252:60911, Sep 30 2008, 15:42:03) 
[GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.now().strftime(u'%Y-%m-%d %H:%M:%S')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: strftime() argument 1 must be str, not unicode
>>> 

I took out the 'u' and it at least loads. Now I can start trying to make
it functional for its intended purpose.

BTW, it works fine without the 'u' on both the older and newer systems:

$ python
Python 2.6 (r26:66714, Jun  8 2009, 16:07:26) 
[GCC 4.4.0 20090506 (Red Hat 4.4.0-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
'2009-10-15 13:09:05'

Of course it's unicode for a reason, it may break without the 'u' in
locales other than mine. And, as Doug points out, I may run into other
unicode-related problems later on.

--Greg




More information about the mythtv-users mailing list