|
Post by Roger Mason on Apr 1, 2022 16:11:56 GMT -8
Has anyone run across (and maybe fixed?) this Python 2.7 Apscheduler bug. I'm running the 2022-01-28 release of PiOS "Buster" which I think includes Apscheduler V3.9.1 I'm wondering if it's an Apscheduler version-related issue since this SkyWeather Python code is a few years old now.
The SkyWeather Python code runs all the way thru one time until it hits "scheduler.start" on line 1842 and terminates with the error info listed below...
Traceback (most recent call last): File "SkyWeather.py", line 1842, in <module> scheduler.start() File "/usr/local/lib/python2.7/dist-packages/apscheduler/schedulers/background.py", line 35, in start BaseScheduler.start(self, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/apscheduler/schedulers/base.py", line 167, in start self._real_add_job(job, jobstore_alias, replace_existing) File "/usr/local/lib/python2.7/dist-packages/apscheduler/schedulers/base.py", line 863, in _real_add_job replacements['next_run_time'] = job.trigger.get_next_fire_time(None, now) File "/usr/local/lib/python2.7/dist-packages/apscheduler/triggers/interval.py", line 68, in get_next_fire_time return normalize(next_fire_time) File "/usr/local/lib/python2.7/dist-packages/apscheduler/util.py", line 431, in normalize return datetime.fromtimestamp(dt.timestamp(), dt.tzinfo) AttributeError: 'datetime.datetime' object has no attribute 'timestamp'
|
|
|
Post by SDL on Apr 2, 2022 10:32:32 GMT -8
That's definitely a Apscheduler error. Since Python2.7 is no longer supported, we will start to see more of these errors. Did you try to update apscheduler?
BP
|
|
|
Post by Roger Mason on Apr 2, 2022 18:03:45 GMT -8
That's definitely a Apscheduler error. Since Python2.7 is no longer supported, we will start to see more of these errors. Did you try to update apscheduler? BP I followed the code build process listed in your Github switchdoclabs/SDL_Pi_SkyWeather README.md document which includes "sudo pip install --upgrade pip setuptools apscheduler requests" I assume that gets me the latest APScheduler code for use with PiOS "Buster" and Python 2.7 . The confusing thing is that all the online info I've seen related to this error "AttributeError: 'datetime.datetime' object has no attribute 'timestamp'" indicates that APScheduler versions supporting Python 3 would not cause this error. Did you use a non-standard version of APScheduler containing backports of later Python 3 version code features when developing Pi SkyWeather?
|
|
|
Post by SDL on Apr 3, 2022 17:27:42 GMT -8
We designed this for the version BEFORE Buster as Python2.7 is no longer supported. Somewhere on the forum is someone who converted SkyWeather to Python 3.0. That might be your best bet.
We just used the standard version of apscheduler available at the time.
BP
|
|
|
Post by Roger Mason on Apr 5, 2022 13:59:16 GMT -8
We designed this for the version BEFORE Buster as Python2.7 is no longer supported. Somewhere on the forum is someone who converted SkyWeather to Python 3.0. That might be your best bet. We just used the standard version of apscheduler available at the time. BP Yes, I found the user "renegade" port of SkyWeather to Python3, and after doing a little additional Python3 code conversion and reverting his code back to work with your SDL-default MySQL db configuration (renegade had customized the MySQL db section for his use) I have SkyWeather running under PiOS "Bullseye" using Python3.x. Interestingly, there were no issues with APScheduler under Python3.x. I am doing data logging to the default MySQL db and generating data graphs successfully.
|
|
|
Post by Powderjockey on Jul 26, 2022 11:47:15 GMT -8
We designed this for the version BEFORE Buster as Python2.7 is no longer supported. Somewhere on the forum is someone who converted SkyWeather to Python 3.0. That might be your best bet. We just used the standard version of apscheduler available at the time. BP Yes, I found the user "renegade" port of SkyWeather to Python3, and after doing a little additional Python3 code conversion and reverting his code back to work with your SDL-default MySQL db configuration (renegade had customized the MySQL db section for his use) I have SkyWeather running under PiOS "Bullseye" using Python3.x. Interestingly, there were no issues with APScheduler under Python3.x. I am doing data logging to the default MySQL db and generating data graphs successfully. Do you have any of the Python3 converted files up on github? or does anyone? I just ran into this problem as well. I had a crash on the system last week and had to start over from scratch. This is the first error I received when starting the system up.
|
|
|
Post by Powderjockey on Jul 28, 2022 18:28:17 GMT -8
Just started to received this error
I don't have any WXLink attached to the station. This was running just fine.
------Patting The Dog------- ERROR:apscheduler.executors.default:Job "readRawWXLink (trigger: interval[0:00:15], next run at: 2022-07-28 20:24:40 MDT)" raised an exception Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/apscheduler/executors/base.py", line 125, in run_job retval = job.func(*job.args, **job.kwargs) File "/home/pi/SDL_Pi_SkyWeather/readLoRa.py", line 300, in readRawWXLink if state.ll.waitRX(timeout=5): File "./pyRFM/lib/ll/ll_rfm9x.py", line 395, in waitRX self.setOpModeRx() File "./pyRFM/lib/ll/ll_rfm9x.py", line 279, in setOpModeRx ret=self.setOpMode(RFM_MODE_RXCONTINUOUS,check) File "./pyRFM/lib/ll/ll_rfm9x.py", line 246, in setOpMode mode File "./pyRFM/lib/pl/pl_serial_seed.py", line 74, in writeRegister self.write(87,addr,None,[val]) File "./pyRFM/lib/pl/pl_serial_seed.py", line 38, in write self.open() File "./pyRFM/lib/pl/pl_serial_seed.py", line 30, in open timeout=0.5 File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 240, in __init__ self.open() File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 268, in open raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg)) SerialException: [Errno 2] could not open port /dev/ttyS0: [Errno 2] No such file or directory: '/dev/ttyS0' [Errno 2] could not open port /dev/ttyS0: [Errno 2] No such file or directory: '/dev/ttyS0' File "/usr/lib/python2.7/dist-packages/apscheduler/executors/base.py", line 125, in run_job retval = job.func(*job.args, **job.kwargs) File "/home/pi/SDL_Pi_SkyWeather/readLoRa.py", line 300, in readRawWXLink if state.ll.waitRX(timeout=5): File "./pyRFM/lib/ll/ll_rfm9x.py", line 395, in waitRX self.setOpModeRx() File "./pyRFM/lib/ll/ll_rfm9x.py", line 279, in setOpModeRx ret=self.setOpMode(RFM_MODE_RXCONTINUOUS,check) File "./pyRFM/lib/ll/ll_rfm9x.py", line 246, in setOpMode mode File "./pyRFM/lib/pl/pl_serial_seed.py", line 74, in writeRegister self.write(87,addr,None,[val]) File "./pyRFM/lib/pl/pl_serial_seed.py", line 38, in write self.open() File "./pyRFM/lib/pl/pl_serial_seed.py", line 30, in open timeout=0.5 File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 240, in __init__ self.open() File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 268, in open raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
------Patting The Dog-------
|
|
kiwx
Junior Member

Posts: 65
|
Post by kiwx on Jul 30, 2022 7:34:36 GMT -8
it must think you do. If it didn't detect the WXLink or SolarMax it wouldn't start the scheduler
#15 seconds if (WXLink_Present) or (SolarMax_Present): scheduler.add_job(readLoRa.readRawWXLink, 'interval', seconds=15)
|
|
|
Post by Powderjockey on Jul 30, 2022 9:22:12 GMT -8
it must think you do. If it didn't detect the WXLink or SolarMax it wouldn't start the scheduler #15 seconds if (WXLink_Present) or (SolarMax_Present): scheduler.add_job(readLoRa.readRawWXLink, 'interval', seconds=15)
I checked to make sure both were commented out in the conflocal.py.
|
|
kiwx
Junior Member

Posts: 65
|
Post by kiwx on Aug 2, 2022 4:16:23 GMT -8
commenting out won't do it. Most of the sensors are "autodetected" by the code.
################ # WXLink Setup
#resetWXLink() That is around line 500 on my SkyWeather.py file. There are about 40 lines of code that test for WXlink to reply. If it does, then the WXlink_Present = true
to test, you might search for WXLink_present = True in the code and set to false.
|
|
|
Post by GosickGeassGate on Mar 14, 2023 6:45:17 GMT -8
You could fix the bug with overriding the method 'normalize' of module 'apscheduler\util.py', like
def normalize(dt): # return datetime.fromtimestamp(dt.timestamp(), dt.tzinfo) import time return datetime.fromtimestamp(time.mktime(dt.timetuple()), dt.tzinfo)
|
|
kiwx
Junior Member

Posts: 65
|
Post by kiwx on Mar 15, 2023 6:02:01 GMT -8
It’s probably an indent error. Took me months to find them all in my python3 conversion.
|
|