Fix UnboundLocalError by ensuring 'out' variable is always initialized#7
Fix UnboundLocalError by ensuring 'out' variable is always initialized#7ruose1314 wants to merge 1 commit into
Conversation
|
Thanks for pointing this out, there is an issue here, but I don't think this is the correct fix. It sounds like you have run into a case for which the file extension is not known - what was the file you were trying to load? It must not have been '.mat'., '.mp4', '.npy', or any of the possible hdf file extensions ('.hdf', '.hf', '.hdf5', '.h5', '.hf5'). If that's the case, better to throw a not-supported error (NotImplementedError) for the particular file type than to simply return none. This should be done with an else statement following the other |
|
In cleaning up some outstanding issues - this still seems worth doing. @ruose1314 , want to do this? Or should I? (we may need to rebase to merge at this point, might be a good exercise) |
The issue was in the load_array function, line 651, it would raise an UnboundLocalError since the returned variable 'out' is defined in if statement, I Initialized 'out' to 'None' at the start of the function to ensure it's always defined (line 671).