It is a new dependency, which is unacceptable, especially for such a minor feature.
Looking through the source code <https://github.com/Cairnarvon/uptime/blob/master/src/__init__.py> for 'uptime', on Python 2 it uses the module MacOS, but under Python 3, it relies on custom ctypes code. If we can't find a way around this, we're just going to have to disable the Mac system uptime tag. -tk On Sun, May 10, 2020 at 6:30 PM Graham Eddy <[email protected]> wrote: > having moved to 4.0.0/python3.7 last night i see a couple of anomalies i > did not notice in testing. > the following one is mainly cosmetic but i think i have a fix for it > > uptime_os (in the “About Station” part of Season skin) presently reports > obviously incorrect value: > > Server uptime > > 18393 days, 0 hours, 10 minutes > > WeeWX uptime > > 0 days, 8 hours, 35 minutes > > WeeWX version > > 4.0.0 > > > looking in weewx/station.py: > > try: > # For MacOs: > from Quartz.QuartzCore import CACurrentMediaTime > os_uptime_secs = CACurrentMediaTime() > except ImportError: > > > a simple test shows the ImportError option is being exercised: > > from Quartz.QuartzCore import CACurrentMediaTime > os_uptime_secs = CACurrentMediaTime() > print(os_uptime_secs) > print(os_uptime_secs/float(3600)) > > and python3.7 (from macports) gives > > Traceback (most recent call last): > File "/Users/graham/a.py", line 1, in <module> > from Quartz.QuartzCore import CACurrentMediaTime > ModuleNotFoundError: No module named 'Quartz' > > but python2.7 (from macos platform), where 3.9.1 worked fine, gives > > 815589.697895 > 226.55269386 > > > reading weewx/station.py, the consequence of following the Import > exception is that os_uptime_secs remains unset i.e. a garbage value > > unfortunately i can’t install the missing module Quartz under python3.7: > > sudo python3.7 -m pip install Quartz > Password: > ... > Collecting Quartz > Downloading quartz-0.0.1.dev0.tar.gz (217 kB) > |████████████████████████████████| 217 kB 694 kB/s > ERROR: Command errored out with exit status 1: > ... > File "/private/tmp/pip-install-36vqysll/Quartz/setup.py", line 7, in > read_dependencies > with open(req_file) as req: > FileNotFoundError: [Errno 2] No such file or directory: > 'requirements.txt' > > > consulting doctor google, i came across module uptime, which i installed > using python3.7 -m pip. > purportedly it is cross-platform including linux and linux-like. it seems > to give the correct result for macos and, if it really is cross-platform, > could simplify weewx/station.py by avoiding testing for each platform itself > > import uptime > secs = uptime.uptime() > print(secs) > print(secs/float(3600)) > > gives good values on my mac server: > > 817999.84659 > 227.22217960833333 > > but it is a dependency on another external module > > g-eddy > > -- > You received this message because you are subscribed to the Google Groups > "weewx-development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-development/8F61A89F-8268-464F-96EA-245700B03B62%40gmail.com > <https://groups.google.com/d/msgid/weewx-development/8F61A89F-8268-464F-96EA-245700B03B62%40gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "weewx-development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/CAPq0zEDq6JaXtH2BTRSpXc8i4%2BN4C9qUWrDciu2Nda8yQ_GobA%40mail.gmail.com.
