rss2i.py: restore: KeyError when no session data is provided
A KeyError
occurs if a restore for a device x
is requested but there is no session data for that device x
in the provided session data file. Note, that such a situation may occur due to #22 (closed).
Reproduce
Assume you have devices x
and y
. Device y
is connected via USB. Perform some measurement with both devices. Make sure device x
is turned off afterwards. Then record the session data:
rss2i -a record -d x,y
An OTA timeout will occur that isn't handled properly (#22 (closed)):
rss2i: Detecting connected devices... [y]
rss2i: Device y --over-the-air--> device x
rss2i: _query@2125: WARN_OVERTHEAIR_TIMEOUT: timeout ocurred when trying to send data to device x
rss2i: Disconnecting devices...ok
Afterwards, the session data of device y
are stored in rec.json
. The ones of device x
are not. Now, try to restore data from both devices using the recorded session data:
rss2i -a restore -f config.txt -d x,y -r rec.json
rss2i: Detecting connected devices... [y]
rss2i: Disconnecting devices...ok
Traceback (most recent call last):
File "/home/maus/bin/rss2i", line 2826, in <module>
main()
File "/home/maus/bin/rss2i", line 2801, in main
args.func(args)
File "/home/maus/bin/rss2i", line 1041, in restore
address = records[str(devID)]['Address']
KeyError: 'x'
Desired Behaviour
That KeyError
should be catched in some way.