Plugin.video.themoviedb.helper: [Error] _strptime import locked by another addon

Created on 24 Jan 2020  路  13Comments  路  Source: jurialmunkey/plugin.video.themoviedb.helper

Keep getting the following error(s) when homescreen widgets point to different lists in this add-on:

ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
           - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
          Error Type: <type 'exceptions.ImportError'>
          Error Contents: Failed to import _strptime because the import lockis held by another thread.
          Traceback (most recent call last):
            File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.themoviedb.helper/plugin.py", line 11, in <module>
              Container().router()
            File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/container.py", line 833, in router
              self.list_becauseyouwatched()
            File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/container.py", line 581, in list_becauseyouwatched
              self.list_tmdb()
            File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/container.py", line 651, in list_tmdb
              'type': cat.get('url_type', '').format(**self.params) or self.item_tmdbtype})
            File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/container.py", line 628, in list_items
              i.get_trakt_watched(trakt_watched) if x == 0 or self.params.get('info') != 'details' else None
            File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/listitem.py", line 129, in get_trakt_watched
              lastplayed = utils.convert_timestamp(item.get('last_watched_at'))
            File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/utils.py", line 158, in convert_timestamp
              time_obj = datetime(*(time.strptime(time_str, time_fmt)[0:6]))
          ImportError: Failed to import _strptime because the import lockis held by another thread.
          -->End of Python script error report<--

ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
           - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
          Error Type: <type 'exceptions.ImportError'>
          Error Contents: Failed to import _strptime because the import lockis held by another thread.
          Traceback (most recent call last):
            File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.themoviedb.helper/plugin.py", line 11, in <module>
              Container().router()
            File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/container.py", line 838, in router
              self.list_tmdb()
            File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/container.py", line 651, in list_tmdb
              'type': cat.get('url_type', '').format(**self.params) or self.item_tmdbtype})
            File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/container.py", line 628, in list_items
              i.get_trakt_watched(trakt_watched) if x == 0 or self.params.get('info') != 'details' else None
            File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/listitem.py", line 129, in get_trakt_watched
              lastplayed = utils.convert_timestamp(item.get('last_watched_at'))
            File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.themoviedb.helper/resources/lib/utils.py", line 158, in convert_timestamp
              time_obj = datetime(*(time.strptime(time_str, time_fmt)[0:6]))
          ImportError: Failed to import _strptime because the import lockis held by another thread.
          -->End of Python script error report<--
bug

Most helpful comment

@jurialmunkey I can confirm that I no longer get the _strptime import error in version 2.2.37.

All 13 comments

Sounds like a circular dependency error... but seems weird it would pop up there?

Full debug log please.

@tjamieg - It's a known python 2.7 bug caused by threaded scripts that don't import modules upfront. I always import modules upfront and I don't use threading, so this bug is almost certainly caused by some other add-on on your system with bad import practices.

EDIT: Potential workaround causes issues so I reverted. You will need to find out what add-on on your system is causing this issue - a good place to start is to uninstall any addon that runs as a service and then reinstall one by one. A full debug log will be useful.

Right, I think I've narrowed the problem down to the following setting:
Accounts / API Keys > Get watched indicators from Trakt

Here's a debug: kodi.log

Right, I think I've narrowed the problem down to the following setting:
Accounts / API Keys > Get watched indicators from Trakt

Here's a debug: kodi.log

That's only because the Trakt look-up uses the strptime function of the datetime module. Some other addon on your system is blocking the import.

Can you try disabling plugin.program.openwizard and restart?

@jurialmunkey There shouldn't be any reason why OpenWizard is causing issues with this, but if there is, let me know and I'll get a fix out!

@jurialmunkey There shouldn't be any reason why OpenWizard is causing issues with this, but if there is, let me know and I'll get a fix out!

It's the only addon I can see in the log which I don't have installed that uses datetime and runs as a thread. The issue wouldn't necessarily be your code (it's a much deeper known bug in python 2) - I'm just trying to narrow down what the conflicting add-on is so that I can reproduce and find the cause.

Scrap that actually. I've just managed to reproduce without openwizard, so that's not it.

@jurialmunkey I didn't think so, but glad you were able to rule it out 馃憤

@tjamieg - Can you test newest version. Hopefully this should fix the error. At the very least it will suppress the Exception traceback so that it doesn't exit the plugin.

Check the log to see if you still get an error like this:

NOTICE: [plugin.video.themoviedb.helper]
    ImportError: Failed to import _strptime because the import lockis held by another thread.

@jurialmunkey I can confirm that I no longer get the _strptime import error in version 2.2.37.

Excellent! Thanks for the bug report and testing! 馃榿

Was this page helpful?
0 / 5 - 0 ratings