question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'datetime.timedelta' object has no attribute 'tzinfo' on windows 10

See original GitHub issue

Issue Description

This is a bit specific, but I’m grasping for straws at this point. So I’m using arrow via a kodi script. And it works without problems on linux. A team member tried using my script on windows 10, he get’s this stack trace.

2019-12-14 10:29:01.961 T:1472   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <class 'AttributeError'>
                                            Error Contents: 'datetime.timedelta' object has no attribute 'tzinfo'
                                            Traceback (most recent call last):
                                              File "C:\KODI\KODI- v19 nightlies\portable_data\addons\metadata.tvdb.com.python\scraper.py", line 3, in <module>
                                                from resources.lib import actions
                                              File "C:\KODI\KODI- v19 nightlies\portable_data\addons\metadata.tvdb.com.python\resources\lib\actions.py", line 10, in <module>
                                                from . import series
                                              File "C:\KODI\KODI- v19 nightlies\portable_data\addons\metadata.tvdb.com.python\resources\lib\series.py", line 11, in <module>
                                                from .ratings import ratings
                                              File "C:\KODI\KODI- v19 nightlies\portable_data\addons\metadata.tvdb.com.python\resources\lib\ratings.py", line 6, in <module>
                                                from .trakt_rating import get_trakt_rating_and_votes
                                              File "C:\KODI\KODI- v19 nightlies\portable_data\addons\metadata.tvdb.com.python\resources\lib\trakt_rating.py", line 1, in <module>
                                                from trakt import Trakt
                                              File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.trakt\lib\trakt\__init__.py", line 3, in <module>
                                                from trakt.client import TraktClient
                                              File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.trakt\lib\trakt\client.py", line 3, in <module>
                                                from trakt.core.configuration import ConfigurationManager
                                              File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.trakt\lib\trakt\core\configuration.py", line 3, in <module>
                                                from trakt.core.context_collection import ContextCollection
                                              File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.trakt\lib\trakt\core\context_collection.py", line 3, in <module>
                                                from trakt.core.helpers import synchronized
                                              File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.trakt\lib\trakt\core\helpers.py", line 9, in <module>
                                                import arrow
                                              File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.arrow\lib\arrow\__init__.py", line 3, in <module>
                                                from .api import get, now, utcnow
                                              File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.arrow\lib\arrow\api.py", line 10, in <module>
                                                from arrow.factory import ArrowFactory
                                              File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.arrow\lib\arrow\factory.py", line 19, in <module>
                                                from arrow.arrow import Arrow
                                              File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.arrow\lib\arrow\arrow.py", line 1396, in <module>
                                                Arrow.max = Arrow.fromdatetime(datetime.max)
                                              File "C:\KODI\KODI- v19 nightlies\portable_data\addons\script.module.arrow\lib\arrow\arrow.py", line 217, in fromdatetime
                                                if dt.tzinfo is None:
                                            AttributeError: 'datetime.timedelta' object has no attribute 'tzinfo'
                                            -->End of Python script error report<--

System Info

  • 🖥 OS name and version: Running on Windows 10, kernel: Windows NT x86 64-bit version 10.0.18362
  • 🐍 Python version: 3.7 (this might be connected as my linux system is already running 3.8)
  • 🏹 Arrow version: 0.15.4

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:24 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
razzeeecommented, Mar 9, 2021

That’s not the correct source (hopefully) Should be https://github.com/Razzeee/script.trakt/tree/3.1.12

But arrow is used in a dependency, which I packaged here: https://github.com/Razzeee/script.module.trakt/blob/master/addon.xml

Problem with updating is right now it depends on version < 1.0.0 https://github.com/fuzeman/trakt.py/blob/master/requirements.txt

1reaction
razzeeecommented, Dec 14, 2019

It’s a different team member, but please keep in mind, that we might deal with a bug in the python version we include in kodi. Which might have patches. I ask him for more info on the sometimes stuff.

Also the first team member I mentioned, had no problems with my script some days ago, then it broke. He might have updated to the latest nightly. I’ll let him try an older build, just to make sure.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'datetime.timedelta' object has no attribute 'tzinfo' on windows 10
spooky. That Python error is caused by datetime.max returning an object of type "bytes" instead of a datetime. I can reproduce it (on...
Read more >
Django - 'datetime.date' object has no attribute 'tzinfo'
I tried to use the recommended approach from the Django docs. tradeDay = day.trade_date + timedelta(hours=6) td1 = pytz.timezone("Europe/London") ...
Read more >
'datetime.date' object has no attribute 'tzinfo' : r/django - Reddit
The database is looking for that timezone info whenever it saves data. So you have to provide it.
Read more >
'datetime.date' object has no attribute 'tzinfo' - Code Grepper
AttributeError : type object 'datetime.datetime' has no attribute 'datetime' ; 1. >>> from datetime import datetime ; 2. >>> datetime ; 3. <type...
Read more >
attributeerror: 'datetime.timedelta' object has no attribute 'hour' - You ...
Return a datetime with the same attributes, except for those attributes given new values by whichever keyword arguments are specified. Note that tzinfo=None...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found