MouseTracks
MouseTracks copied to clipboard
Lazy load bypasses corrupt file check
Just came across this error after a crash:
Traceback (most recent call last):
File "D:\Peter\Documents\Github\MouseTracks\core\track\background.py", line 357, in background_process
record_mouse_move(store, received_data['MouseMove'])
File "D:\Peter\Documents\Github\MouseTracks\core\track\background.py", line 688, in record_mouse_move
store['Data']['Resolution'][resolution]['Tracks'][y][x] = store['Data']['Ticks']['Tracks']
File "D:\Peter\Documents\Github\MouseTracks\core\numpy.py", line 278, in __getitem__
return self.array[item]
File "D:\Peter\Documents\Github\MouseTracks\core\numpy.py", line 274, in array
self._array = self._load()
File "D:\Peter\Documents\Github\MouseTracks\core\numpy.py", line 261, in _load
return load(array)
File "D:\Peter\Documents\Github\MouseTracks\core\numpy.py", line 232, in load
return numpy.load(f)
File "D:\Peter\Documents\Github\MouseTracks\env27\lib\site-packages\numpy\lib
pyio.py", line 443, in load
"Failed to interpret file %s as a pickle" % repr(file))
IOError: Failed to interpret file <cStringIO.StringO object at 0x00000000132E0FB8> as a pickle
It appears the "lazy loading" module bypasses the corrupt file check. Potential fix would be to read the corrupt array from the backup file, but there may be issues if there's been any changes in resolution, so instead I may have to figure out how to discard the current data and load the previous. Alternatively some way of verifying the file was saved correctly would be useful.
Actually, from a little testing, I'm not sure how that slipped through the cracks as I can't successfully load it up. I found another issue though in that failing to load a corrupt file will also remove the backup.