开发者

Convert dbus.String to normal string

I am using dbus to get the current playing song from Songbird Media Player & Metadata is also taken from dbus object.

The line where error comes is:-

audio_file = MP3(current_playing_track['location'], ID3=ID3)

The error is:-

 Traceback (most recent call last):
  File "./last.py", line 42, in <module>
    audio_file = MP3(current_pla开发者_运维百科ying_track['location'], ID3=ID3)
  File "/usr/lib/python2.6/dist-packages/mutagen/__init__.py", line 73, in __init__
    self.load(filename, *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/mutagen/id3.py", line 1949, in load
    try: self.tags = ID3(filename, **kwargs)
  File "/usr/lib/python2.6/dist-packages/mutagen/id3.py", line 74, in __init__
    super(ID3, self).__init__(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/mutagen/_util.py", line 103, in __init__
    super(DictProxy, self).__init__(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/mutagen/__init__.py", line 37, in __init__
    self.load(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/mutagen/id3.py", line 109, in load
    self.__fileobj = file(filename, 'rb')
IOError: [Errno 2] No such file or directory: dbus.String(u'file:///media/Misc/Songbird%20Library/Puddle%20Of%20Mudd/Puddle%20Of%20Mudd%20-%20Unknown%20Album%20-%20Spin%20You%20Around.mp3', variant_level=1)

How do I convert file location to a normal string?


Just do str( your_dbus_string )

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜