2010-02-25 177 views
1

我使用dbus從Songbird媒體播放器獲取當前播放的歌曲&元數據也來自dbus對象。將dbus.String轉換爲普通字符串

其中錯誤出現的行是: -

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

的錯誤是: -

Traceback (most recent call last): 
    File "./last.py", line 42, in <module> 
    audio_file = MP3(current_playing_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) 

如何文件位置轉換爲普通的字符串

回答

6

只是做str(your_dbus_string)

+0

:OMG:這是真正的輕鬆。 在不到1分鐘內回覆完美。 Thanx .. – 2010-02-25 17:31:28

+0

....我的榮幸! – jldupont 2010-02-25 17:43:37

相關問題