我正在尝试运行我在 Raspberry Pi Zero 上编写的 python 脚本,但我不断收到错误OverflowError: timestamp out of range for platform time_t
。我相对确定这是 pi 的 32 位 ARM 架构的问题,但我似乎无法找到解决方法。
这是回溯(主要是为了后代,因为我不认为 python 是问题所在):
File "twitter.py", line 37, in <module>
t.run.Search(c)
File "/home/pi/.local/lib/python3.7/site-packages/twint/run.py", line 288, in Search
run(config, callback)
File "/home/pi/.local/lib/python3.7/site-packages/twint/run.py", line 209, in run
get_event_loop().run_until_complete(Twint(config).main(callback))
File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "/home/pi/.local/lib/python3.7/site-packages/twint/run.py", line 150, in main
await task
File "/home/pi/.local/lib/python3.7/site-packages/twint/run.py", line 194, in run
await self.tweets()
File "/home/pi/.local/lib/python3.7/site-packages/twint/run.py", line 141, in tweets
await output.Tweets(tweet, self.config, self.conn)
File "/home/pi/.local/lib/python3.7/site-packages/twint/output.py", line 142, in Tweets
await checkData(tweets, config, conn)
File "/home/pi/.local/lib/python3.7/site-packages/twint/output.py", line 116, in checkData
panda.update(tweet, config)
File "/home/pi/.local/lib/python3.7/site-packages/twint/storage/panda.py", line 67, in update
day = weekdays[strftime("%A", localtime(Tweet.datetime))]
OverflowError: timestamp out of range for platform time_t
我做了一些搜索并发现了类似的问题,但大多数问题都是直接转换时间戳,而我的问题似乎是设置时间。我尝试重新启动 Pi 并立即运行脚本以查看问题是否与 Pi 的正常运行时间有关,但返回的结果相同。
我从上述所有内容得出的结论是,这可能与 pi 的 ntp 时间同步有关?
这是我的timedatectl status
输出:
Local time: Wed 2020-01-22 17:39:22 EST
Universal time: Wed 2020-01-22 22:39:22 UTC
RTC time: n/a
Time zone: America/New_York (EST, -0500)
System clock synchronized: no
NTP service: inactive
RTC in local TZ: no
时区等是正确的,所以说实话,我在这里画了一个空白。有人有什么建议吗?