maloep/romcollectionbrowser

Matrix Version: "xbmc" has no attribute "translatepath"

Opened this issue · 2 comments

Hi,
not sure if thats a real bug or just something happening on my setup but I thought it may be worth sharing it.
When I tried starting the RCB with my current Matrix Kodi (20.0-ALPHA1 (19.90.101) Git:20210725-58e75a75f8) running on Ubuntu Focal (LTS) I got the following error:

Error Type: <class 'AttributeError'>
Error Contents: module 'xbmc' has no attribute 'translatePath'
Traceback (most recent call last):
  File "/home/kodi/.kodi/addons/plugin.games.rom.collection.browser.widget/default.py", line 18, in <module>
    widget.Widget().runPlugin()
  File "/home/kodi/.kodi/addons/plugin.games.rom.collection.browser.widget/resources/lib/widget.py", line 64, in runPlugin
    gdb = self.openDbConnection()
  File "/home/kodi/.kodi/addons/plugin.games.rom.collection.browser.widget/resources/lib/widget.py", line 212, in openDbConnection
    gdb = GameDataBase(util.getAddonDataPath())
  File "/home/kodi/.kodi/addons/script.games.rom.collection.browser/resources/lib/util.py", line 209, in getAddonDataPath
    path = convertToUnicodeString(xbmc.translatePath('special://profile/addon_data/%s' % (SCRIPTID)))
AttributeError: module 'xbmc' has no attribute 'translatePath'
-->End of Python script error report<--

I remembered having a similar problem before and changed in the util.py in line 209 from
path = convertToUnicodeString(xbmc.translatePath('special://profile/addon_data/%s' % (SCRIPTID)))
to
path = convertToUnicodeString(xbmcvfs.translatePath('special://profile/addon_data/%s' % (SCRIPTID)))
The xbmc virtual file system documentation at least said it had a "translatepath" function and I gave it a shot. Not sure if I made it batter or worse now butit worked. I just tested several games and it seems to work.

Maybe it's a fluke, maybe it's a solution - Would be nice if somebody could verify this if the same error is stumbled upon?

Can confirm this issue. Same here on LE 11 nightly-20211212-7ed4d18 / (20.0-ALPHA1 (19.90.101) Git 20211212

Can also confirm above fix suggested by @ISharkI. Is "xbmc.translatePath" deprecated?

Just recently seen in kodi.log:

2021-12-29 17:19:23.037 T:1489 WARNING <general>: xbmc.translatePath is deprecated and might be removed in future kodi versions. Please use xbmcvfs.translatePath instead.

There is a merged PR, which should fix this. But somehow it is still missing in recent version.