0

I'm trying to run a python script I wrote on my Raspberry Pi Zero but I keep getting the error OverflowError: timestamp out of range for platform time_t.

I'm relatively certain it's something with the 32-bit ARM architecture of the pi, but I can't seem to figure out a workaround.

Here's the traceback (including for posterity as I don't think python is the issue):

  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

I've done some searching and found similar(ish) issues, but most of them are with directly converting timestamps, where mine appears to be with setting a time. I've tried rebooting the Pi and immediately running the script to see if the issue is with the Pi's uptime, but that returned the same.

My conclusion from all of the above is that it might be something with the pi's NTP time sync?

Heres my timedatectl status output:

               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

The timezone and such is correct, so honestly, I'm drawing a blank here. Does anyone have any tips?

Thanks, Ben

  • 1
    Why not explain what you are trying to do? We might be able to suggest a solution. – joan Jan 22 at 22:46
  • @joan long story short it analyzes the sentiments of tweets that mention specific stock names. the bit that it's getting caught up on is where it scans for tweets. I've had it running perfectly on both Google colab and in pycharm on Ubuntu 16.04 and 18.04. – Benjamin Fasick Jan 22 at 22:52
  • Why ask a coding question but not include the code? – Milliways Jan 22 at 23:00
  • @Milliways I'm certain it's not a problem with my code, and I already asked on stackoverflow. I've used the same code on Google colab and in pycharm on Ubuntu 16.04 and 18.04 with no problem at all. The only difference between the executions are the environments, in this case the CACHE_TIME variable. – Benjamin Fasick Jan 22 at 23:04
  • perhaps you need to be asking at a Linux centric site ... your question does not look like it is related to the RPi – jsotola Jan 22 at 23:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.