2022-12-27, 05:47
Hello, i was wondering if in Kodi 20 the xbmc.translatePath method has been removed? Or is this a bug in Kodi 20?
in some of my addons i use this kinda of code:
LIB_DIR = xbmc.translatePath(
os.path.join(xbmcaddon.Addon(id="plugin.video.dumpert").getAddonInfo('path'), 'resources', 'lib'))
sys.path.append(LIB_DIR)
In Kodi 20 however this will fail:
2022-12-27 04:33:37.000 T:12828 debug <general>: CPythonInvoker(16): resume:false
2022-12-27 04:33:37.000 T:12828 debug <general>: CPythonInvoker(16, F:\Kodi_20.x_Portable\portable_data\addons\plugin.video.dumpert\addon.py): entering source directory F:\Kodi_20.x_Portable\portable_data\addons\plugin.video.dumpert
2022-12-27 04:33:37.000 T:12828 debug <general>: CPythonInvoker(16, F:\Kodi_20.x_Portable\portable_data\addons\plugin.video.dumpert\addon.py): instantiating addon using automatically obtained id of "plugin.video.dumpert" dependent on version 3.0.0 of the xbmc.python api
2022-12-27 04:33:37.044 T:12828 error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class 'AttributeError'>
Error Contents: module 'xbmc' has no attribute 'translatePath'
Traceback (most recent call last):
File "F:\Kodi_20.x_Portable\portable_data\addons\plugin.video.dumpert\addon.py", line 16, in <module>
LIB_DIR = xbmc.translatePath(
AttributeError: module 'xbmc' has no attribute 'translatePath'
-->End of Python script error report<--
2022-12-27 04:33:37.044 T:12828 debug <general>: CPythonInvoker::onExecutionDone(16, F:\Kodi_20.x_Portable\portable_data\addons\plugin.video.dumpert\addon.py)
2022-12-27 04:33:37.044 T:12828 debug <general>: .
2022-12-27 04:33:37.079 T:10848 info <general>: Skipped 1 duplicate messages..
This code works fine in older versions of Kodi.
Thanks for the info
in some of my addons i use this kinda of code:
LIB_DIR = xbmc.translatePath(
os.path.join(xbmcaddon.Addon(id="plugin.video.dumpert").getAddonInfo('path'), 'resources', 'lib'))
sys.path.append(LIB_DIR)
In Kodi 20 however this will fail:
2022-12-27 04:33:37.000 T:12828 debug <general>: CPythonInvoker(16): resume:false
2022-12-27 04:33:37.000 T:12828 debug <general>: CPythonInvoker(16, F:\Kodi_20.x_Portable\portable_data\addons\plugin.video.dumpert\addon.py): entering source directory F:\Kodi_20.x_Portable\portable_data\addons\plugin.video.dumpert
2022-12-27 04:33:37.000 T:12828 debug <general>: CPythonInvoker(16, F:\Kodi_20.x_Portable\portable_data\addons\plugin.video.dumpert\addon.py): instantiating addon using automatically obtained id of "plugin.video.dumpert" dependent on version 3.0.0 of the xbmc.python api
2022-12-27 04:33:37.044 T:12828 error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class 'AttributeError'>
Error Contents: module 'xbmc' has no attribute 'translatePath'
Traceback (most recent call last):
File "F:\Kodi_20.x_Portable\portable_data\addons\plugin.video.dumpert\addon.py", line 16, in <module>
LIB_DIR = xbmc.translatePath(
AttributeError: module 'xbmc' has no attribute 'translatePath'
-->End of Python script error report<--
2022-12-27 04:33:37.044 T:12828 debug <general>: CPythonInvoker::onExecutionDone(16, F:\Kodi_20.x_Portable\portable_data\addons\plugin.video.dumpert\addon.py)
2022-12-27 04:33:37.044 T:12828 debug <general>: .
2022-12-27 04:33:37.079 T:10848 info <general>: Skipped 1 duplicate messages..
This code works fine in older versions of Kodi.
Thanks for the info