I don't understand why there would not be a record with the record's
timestamp in the database, but I added a check just in case.

Commit 538736b
<https://github.com/weewx/weewx/commit/538736b582ab301cc9f8d430564473bb4d3c7923>

-tk

On Wed, Apr 3, 2019 at 6:52 PM Thomas Keffer <[email protected]> wrote:

> Hmm, well that's a little odd.
>
> The AWEKAS restx code is doing a query for rainRate where dateTime is the
> time in the record:
>
> rr = dbmanager.getSql('select rainRate from %s where dateTime=?' %
>                       dbmanager.table_name, (r['dateTime'],))
>
>
> Evidently, there is no record in the database with timestamp
> r['dateTime'].
>
> Are you doing something unusual here?
>
> -tk
>
>
> On Wed, Apr 3, 2019 at 6:11 PM Luc Heijst <[email protected]> wrote:
>
>> Tom,
>>
>> I got an exception error in module restx of version 3.9.1.
>>
>> Apr  3 17:19:36 pi21 mstk[15364]: engine: Caught unrecoverable exception
>> in engine:
>> Apr  3 17:10:14 pi21 mstk[14530]: restx: AWEKAS: Unexpected exception of
>> type <type 'exceptions.TypeError'>
>> Apr  3 17:10:14 pi21 mstk[14530]: *** Traceback (most recent call last):
>> Apr  3 17:10:14 pi21 mstk[14530]: ***   File
>> "/home/weewx/bin/weewx/restx.py", line 350, in run_loop
>> Apr  3 17:10:14 pi21 mstk[14530]: ***     self.process_record(_record,
>> dbmanager)
>> Apr  3 17:10:14 pi21 mstk[14530]: ***   File
>> "/home/weewx/bin/weewx/restx.py", line 1693, in process_record
>> Apr  3 17:10:14 pi21 mstk[14530]: ***     r = self.get_record(record,
>> dbmanager)
>> Apr  3 17:10:14 pi21 mstk[14530]: ***   File
>> "/home/weewx/bin/weewx/restx.py", line 1689, in get_record
>> Apr  3 17:10:14 pi21 mstk[14530]: ***     r['rainRate'] = rr[0]
>> Apr  3 17:10:14 pi21 mstk[14530]: *** TypeError: 'NoneType' object has no
>> attribute '__getitem__'
>> Apr  3 17:10:14 pi21 mstk[14530]: restx: AWEKAS: Thread exiting. Reason:
>> 'NoneType' object has no attribute '__getitem__'
>>
>>         # Otherwise, augment with rainRate, which AWEKAS expects. If the
>>         # archive does not have rainRate, an exception will be raised.
>>         # Be prepare to catch it.
>>         try:
>>             rr = dbmanager.getSql('select rainRate from %s where
>> dateTime=?' %
>>                                   dbmanager.table_name, (r['dateTime'],))
>>         except weedb.OperationalError:
>>             pass
>>         else:
>>             r['rainRate'] = rr[0]
>>         return r
>>
>> Luc
>>
>> --
>> 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 [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to