after midnight (2017-07-30 / 2017-07-31):--
Jul 31 10:30:14 debian1 weewx[143]: cheetahgenerator: Generate failed with exception '<type 'exceptions.ValueError'>'
Jul 31 10:30:14 debian1 weewx[143]: cheetahgenerator: **** Ignoring template /etc/weewx/skins/Standard/index.html.tmpl
Jul 31 10:30:14 debian1 weewx[143]: cheetahgenerator: **** Reason: day is out of range for month
Jul 31 10:30:14 debian1 weewx[143]: **** Traceback (most recent call last):
Jul 31 10:30:14 debian1 weewx[143]: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 329, in generate
Jul 31 10:30:14 debian1 weewx[143]: **** print >> _file, compiled_template
Jul 31 10:30:14 debian1 weewx[143]: **** File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1005, in __str__
Jul 31 10:30:14 debian1 weewx[143]: **** rc = getattr(self, mainMethName)()
Jul 31 10:30:14 debian1 weewx[143]: **** File "_etc_weewx_skins_Standard_index_html_tmpl.py", line 1663, in respond
Jul 31 10:30:14 debian1 weewx[143]: **** File "_etc_weewx_skins_Standard_index_html_tmpl.py", line 707, in __errorCatcher92
Jul 31 10:30:14 debian1 weewx[143]: **** File "<string>", line 1, in <module>
Jul 31 10:30:14 debian1 weewx[143]: **** File "/usr/share/weewx/weewx/tags.py", line 101, in span
Jul 31 10:30:14 debian1 weewx[143]: **** hour_delta=hour_delta, day_delta=day_delta, week_delta=week_delta, month_delta=month_delta, year_delta=year_delta),
Jul 31 10:30:14 debian1 weewx[143]: **** File "/usr/share/weewx/weeutil/weeutil.py", line 532, in archiveSpanSpan
Jul 31 10:30:14 debian1 weewx[143]: **** start_dt = time_dt.replace(year=year, month=month)
Jul 31 10:30:14 debian1 weewx[143]: **** ValueError: day is out of range for month
weewx version v3.7.1
problem with 31days for July?
thanks
Pavel
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#set $archive_data = [$day, $span($week_delta=1), $span($month_delta=1), $span($year_delta=1), $week, $month, $year]
...
#for $archive in $archive_data
<td class="data new_row">$archive.outTemp.max.format(add_label=False)<br/>
<span class="timestamp">$archive.outTemp.maxtime.format($dt_format[$archive_data.index($archive)])</span><br/>
$archive.outTemp.min.format(add_label=False)<br/>
<span class="timestamp">$archive.outTemp.mintime.format($dt_format[$archive_data.index($archive)])</span>
</td>
#end for
#set $archive_data = [$day, $span($day_delta=7), $span($day_delta=30), $span($day_delta=365), $week, $month, $year]
Jul 31 00:50:24 rpi-meteo weewx[25170]: cheetahgenerator: Generate failed with exception '<type 'exceptions.ValueError'>'
Jul 31 00:50:24 rpi-meteo weewx[25170]: cheetahgenerator: **** Ignoring template /etc/weewx/skins/Seasons/index.html.tmpl
Jul 31 00:50:24 rpi-meteo weewx[25170]: cheetahgenerator: **** Reason: day is out of range for month
Jul 31 00:50:24 rpi-meteo weewx[25170]: **** Traceback (most recent call last):
Jul 31 00:50:24 rpi-meteo weewx[25170]: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 332, in generate
Jul 31 00:50:24 rpi-meteo weewx[25170]: **** fd.write(str(compiled_template))
Jul 31 00:50:24 rpi-meteo weewx[25170]: **** File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1005, in __str__
Jul 31 00:50:24 rpi-meteo weewx[25170]: **** rc = getattr(self, mainMethName)()
Jul 31 00:50:24 rpi-meteo weewx[25170]: **** File "_etc_weewx_skins_Seasons_index_html_tmpl.py", line 218, in respond
Jul 31 00:50:24 rpi-meteo weewx[25170]: **** File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1615, in _handleCheetahInclude
Jul 31 00:50:24 rpi-meteo weewx[25170]: **** self._CHEETAH__cheetahIncludes[_includeID].respond(trans)
Jul 31 00:50:24 rpi-meteo weewx[25170]: **** File "_etc_weewx_skins_Seasons_hilo_inc.py", line 94, in respond
Jul 31 00:50:24 rpi-meteo weewx[25170]: **** File "/usr/share/weewx/weewx/tags.py", line 101, in span
Jul 31 00:50:24 rpi-meteo weewx[25170]: **** hour_delta=hour_delta, day_delta=day_delta, week_delta=week_delta, month_delta=month_delta, year_delta=year_delta),
Jul 31 00:50:24 rpi-meteo weewx[25170]: **** File "/usr/share/weewx/weeutil/weeutil.py", line 475, in archiveSpanSpan
Jul 31 00:50:24 rpi-meteo weewx[25170]: **** start_dt = time_dt.replace(year=year, month=month)
Jul 31 00:50:24 rpi-meteo weewx[25170]: **** ValueError: day is out of range for month
To unsubscribe from this group and stop receiving emails from it, send an email to weewx...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/fe6603a7-00f7-4d6e-8537-ccebca757891%40googlegroups.com.
Finally got around to looking at this and now I'm not so sure it is a bug.Let me ask you a question: given the date you were using, 31 July, what was your expectation for the date a month earlier? Not 31 June; there is no such day.One could say it should be the last day in June, that is, 30 June. That might make sense, but then it leads to some strange corner cases:What is 30 March minus one month? By this solution, it should be 28 Feb.So then what is 29 March minus one month? Also 28 Feb? And so would 28 March minus a month. So, "one month earlier" for three days in a row leads to the same date?Any ideas?-tk
On Tue, Jul 30, 2019 at 5:17 PM Thomas Keffer <tke...@gmail.com> wrote:
Thanks, mph. This helps! It seems the problem is on the last day of a long month that follows a short month.I've created issue #436 to track.-tk
To unsubscribe from this group and stop receiving emails from it, send an email to weewx...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/6b4c212c-2225-4771-8bdd-92631109aff7%40googlegroups.com.
don’t know enough about specifying timespans within weewx but you can do things likesqlite3> select datetime(dateTime, 'unixepoch’, ’localtime’, ’-1 months’) from archive;and
bash$ date -v-1m____________Graham Eddy
On 19 Sep 2019, at 4:37 pm, gjr80 <gjrod...@gmail.com> wrote:
I had a similar issue with WeeWX-WD some years back, the Saratoga templates needed to display some observation (temp or rain - can't remember) for the same time past month. To be honest I can't remember what I had it return for 'problem' dates, it certainly was not None or some other undefined value.That aside, whether you call it a bug or not I don't think we should have a tag that when you give it an allowed value/parameter it aborts the template. Perhaps return None so the template is still processed and then at least the user has some value to hang his hat on.Gary--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx...@googlegroups.com.
That aside, whether you call it a bug or not I don't think we should have a tag that when you give it an allowed value/parameter it aborts the template.
Hi all,
the primary requirement is: „Do not generate errors on month_delta mathematics“
The implementation and thus resulting date is not so important, I think.
So if we will implement any error-free logic, then everything will be ok.
In my opinion, if the user has date say Mar
10th, or 03/10 and wants to subtract one month, it just wants to do MM=03-1
-> 02/10. If the formula generates invalid date (03/31 -> 02/31) then we
should offer a valid date, e.g. 02/28. Nothing more special.
For general use the implementation of any existing logic (bash) should be
acceptable.
Thank you
Pavel
--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/36ad9d07-b295-4733-b0b2-44c9437133cd%40googlegroups.com.
I guess I'm queasy at the thought of a solution that simply does not raise an error. It should obey some basic laws of math. For example, subtracting a month, then adding it back on should yield the same date. This solution would not.I'm in favor of eliminating month arithmetic. It doesn't add anything.Alternatively, we could leave it in, but require the user to catch any exceptions, then make up his/her mind what the semantics should be.-tk
On Thu, Sep 19, 2019 at 6:25 AM mph <mph....@gmail.com> wrote:
--Hi all,
the primary requirement is: „Do not generate errors on month_delta mathematics“
The implementation and thus resulting date is not so important, I think.
So if we will implement any error-free logic, then everything will be ok.
In my opinion, if the user has date say Mar 10th, or 03/10 and wants to subtract one month, it just wants to do MM=03-1 -> 02/10. If the formula generates invalid date (03/31 -> 02/31) then we should offer a valid date, e.g. 02/28. Nothing more special.
For general use the implementation of any existing logic (bash) should be acceptable.Thank you
Pavel
Dne čtvrtek 19. září 2019 15:00:20 UTC+2 Thomas Keffer napsal(a):On Wed, Sep 18, 2019 at 11:37 PM gjr80 <gjrod...@gmail.com> wrote:That aside, whether you call it a bug or not I don't think we should have a tag that when you give it an allowed value/parameter it aborts the template.We don't. The tag that caused the error was user-supplied.From Graham's experiments, it looks like sqlite and bash simply subtract four weeks. The span tag can already do that, so if that's what the user wants, s/he can just specify it.As for Python, it doesn't even offer month arithmetic (at least, through class datetime.timedelta), probably for the reasons we have discovered. I'm thinking we should do the same.-tk
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/9df7a851-5ec6-43c3-8231-4d6f06364a58%40googlegroups.com.
I'm in favor of eliminating month arithmetic. It doesn't add anything.
On Wed, Sep 18, 2019 at 11:37 PM gjr80 <gjrod...@gmail.com> wrote:That aside, whether you call it a bug or not I don't think we should have a tag that when you give it an allowed value/parameter it aborts the template.We don't. The tag that caused the error was user-supplied.
As for Python, it doesn't even offer month arithmetic (at least, through class datetime.timedelta), probably for the reasons we have discovered. I'm thinking we should do the same.
Might as well set Pi=3 while you're at it(sarcasm)Seriously. Please don't set month=30 days. It won't end well.
--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/7086c963-6b87-48c1-8ad8-04be4ecb8e97%40googlegroups.com.
On 20 Sep 2019, at 10:30 am, Thomas Keffer <tke...@gmail.com> wrote:
Damn. I just realized we have the same problem with years. Quick, what is 2016-02-29 minus one year?
--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAPq0zEByjsdoPLNX5ASoKOkrMSLbH1pmeVJrZOTunT1mb1_Z%3Dw%40mail.gmail.com.
I guess I'm queasy at the thought of a solution that simply does not raise an error. It should obey some basic laws of math. For example, subtracting a month, then adding it back on should yield the same date. This solution would not.I'm in favor of eliminating month arithmetic. It doesn't add anything.Alternatively, we could leave it in, but require the user to catch any exceptions, then make up his/her mind what the semantics should be.-tk
On Thu, Sep 19, 2019 at 6:25 AM mph <mph....@gmail.com> wrote:
--Hi all,
the primary requirement is: „Do not generate errors on month_delta mathematics“
The implementation and thus resulting date is not so important, I think.
So if we will implement any error-free logic, then everything will be ok.
In my opinion, if the user has date say Mar 10th, or 03/10 and wants to subtract one month, it just wants to do MM=03-1 -> 02/10. If the formula generates invalid date (03/31 -> 02/31) then we should offer a valid date, e.g. 02/28. Nothing more special.
For general use the implementation of any existing logic (bash) should be acceptable.Thank you
Pavel
Dne čtvrtek 19. září 2019 15:00:20 UTC+2 Thomas Keffer napsal(a):On Wed, Sep 18, 2019 at 11:37 PM gjr80 <gjrod...@gmail.com> wrote:That aside, whether you call it a bug or not I don't think we should have a tag that when you give it an allowed value/parameter it aborts the template.We don't. The tag that caused the error was user-supplied.From Graham's experiments, it looks like sqlite and bash simply subtract four weeks. The span tag can already do that, so if that's what the user wants, s/he can just specify it.As for Python, it doesn't even offer month arithmetic (at least, through class datetime.timedelta), probably for the reasons we have discovered. I'm thinking we should do the same.-tk
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/rmisgor83s9.fsf%40s1.lexort.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAPq0zEDrEAtiz_i3%3DWi-Nrn%2BYHpprHT89R0zmv4SUHbiOQmQ_g%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAA1SM21MixgytdiQmHR-c6q4af9z_29t793RvvJGXc8dFZ8rJw%40mail.gmail.com.