Fix UnboundLocalError due to undefined value variable#19
Conversation
|
Thanks!! Can you supply a test case? |
|
Hi, sure. This is my first time contributing to a project, so please tell me if this isn’t what you wanted. I was running this script, which I made to convert every single xls file in a given folder to xlsx (and then send the originals to the Recycle Bin): This made me see the following output on the console: That is, until I made the edit to |
|
Update: I thought for a while and noticed that I should probably give you the xls files I was working with. To be sure, I notice now that it wasn’t just any Excel file, it was xls files of bank statements generated by Banco Itaú. Since they have sensitive company information, I’m working on some way to give you one to look at. If I edit them and save them again, Excel converts them to a non-problematic xls, so I can’t easily redact the content. |
|
Alright, it took me a lot of work but I managed to make a test file that reproduces the behavior that I was seeing, and which contains no sensitive information because I have scrambled every letter and number, all the while without actually opening the file in Excel. I used a hex editor and parsed it, basically. The output of the script does look off, stylistically, compared to the result of opening the file in Excel directly. This is a behavior that also happened with the original unexpunged file, and I’m not sure how to handle it right now. But my commit at least makes the program handle this file without an error. |
I was getting this error so I made this change that fixes the error. Please review this change and merge if appropriate.