Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

average_temperature from current_daily_data can be None #50

Open
1 of 6 tasks
llluis opened this issue Dec 28, 2019 · 0 comments
Open
1 of 6 tasks

average_temperature from current_daily_data can be None #50

llluis opened this issue Dec 28, 2019 · 0 comments

Comments

@llluis
Copy link
Contributor

llluis commented Dec 28, 2019

Describe the bug
If you query HQ close to midnight, data is still being rolled out.
One corner case is already taken care of (yesterday - 1).
But, HQ will release the consumption without average_temperature.

image

If you query during this interval, you get None and code can crash.

Traceback (most recent call last):
  File "/usr/local/bin/pyhydroquebec", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/pyhydroquebec/__main__.py", line 168, in main
    output_text(results[0], args.hourly)
  File "/usr/local/lib/python3.7/site-packages/pyhydroquebec/outputter.py", line 24, in output_text
    print(YESTERDAY_TPL.format(d=data))
TypeError: unsupported format string passed to NoneType.__format__

To Reproduce
Run the std use case

pyhydroquebec -u XXX -p XXX

Expected behavior
No errors. :)

PyHydroQuebec and Python version
Python 3.7.5
PyHydroQuebec 3.0.0 (master as of today)

Corner Cases
Are you in one of this situations:

  • Change of address
  • Change of rate
  • Add a new contract
  • Remove an old contract
  • No
  • Other: query close to midnight (2AM in my test)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant