Fix sys append using module before its init

This commit is contained in:
tomkat83 2016-05-07 13:25:51 +02:00
parent df38786638
commit 5240afaf52
3 changed files with 48 additions and 14 deletions

View file

@ -10,13 +10,25 @@ import xbmc
import xbmcaddon
import xbmcgui
import utils
addon_ = xbmcaddon.Addon(id='plugin.video.plexkodiconnect')
addon_path = utils.tryDecode(addon_.getAddonInfo('path'))
base_resource = utils.tryDecode(xbmc.translatePath(os.path.join(addon_path, 'resources', 'lib')))
_addon = xbmcaddon.Addon(id='plugin.video.plexkodiconnect')
try:
addon_path = _addon.getAddonInfo('path').decode('utf-8')
except TypeError:
addon_path = _addon.getAddonInfo('path').decode()
try:
base_resource = xbmc.translatePath(os.path.join(
addon_path,
'resources',
'lib')).decode('utf-8')
except TypeError:
base_resource = xbmc.translatePath(os.path.join(
addon_path,
'resources',
'lib')).decode()
sys.path.append(base_resource)
import utils
import artwork
import clientinfo
import downloadutils

View file

@ -10,18 +10,30 @@ import xbmc
import xbmcaddon
import xbmcgui
import utils
###############################################################################
addon_ = xbmcaddon.Addon(id='plugin.video.plexkodiconnect')
addon_path = utils.tryDecode(addon_.getAddonInfo('path'))
base_resource = utils.tryDecode(xbmc.translatePath(os.path.join(addon_path, 'resources', 'lib')))
_addon = xbmcaddon.Addon(id='plugin.video.plexkodiconnect')
try:
addon_path = _addon.getAddonInfo('path').decode('utf-8')
except TypeError:
addon_path = _addon.getAddonInfo('path').decode()
try:
base_resource = xbmc.translatePath(os.path.join(
addon_path,
'resources',
'lib')).decode('utf-8')
except TypeError:
base_resource = xbmc.translatePath(os.path.join(
addon_path,
'resources',
'lib')).decode()
sys.path.append(base_resource)
###############################################################################
import entrypoint
import utils
###############################################################################

View file

@ -11,19 +11,29 @@ import xbmc
import xbmcaddon
import xbmcgui
import utils
###############################################################################
_addon = xbmcaddon.Addon(id='plugin.video.plexkodiconnect')
addon_path = utils.tryDecode(_addon.getAddonInfo('path'))
base_resource = utils.tryDecode(xbmc.translatePath(os.path.join(
addon_path,
'resources',
'lib')))
try:
addon_path = _addon.getAddonInfo('path').decode('utf-8')
except TypeError:
addon_path = _addon.getAddonInfo('path').decode()
try:
base_resource = xbmc.translatePath(os.path.join(
addon_path,
'resources',
'lib')).decode('utf-8')
except TypeError:
base_resource = xbmc.translatePath(os.path.join(
addon_path,
'resources',
'lib')).decode()
sys.path.append(base_resource)
###############################################################################
import utils
import userclient
import clientinfo
import initialsetup