-
Notifications
You must be signed in to change notification settings - Fork 3
Debugging the code when ValueError: Required attribute: occurs
Giacomo Marchioro edited this page Mar 10, 2022
·
1 revision
It should be quite clear where the error happens during the insertion of an invalid value through the iiifpapi module. However, missing Required
statements need some tools to solve them because they are checked when the manifest/collection is written in the JSON file hence the error does not show exactly when the error occurred.
The suggested approach is the following:
- Open
ipython
console - run your script using
%run myscript.py
- activate the debug tool using
%debug
- press
u
and enter until you see the frame where the manifest/collection is defined e.g.mymanifest.json_save("SFMAG_manifest30.json")
- now use
.show_errors_in_browser()
function on the istance of your manifest/collection e.g.mymanifest.show_errors_in_browser()
- A new tab in the browser should open (try to execute the command again if it does not).
- You can use your browser built-in search tool for searching the
❌Required
string this will bring you exactly where the error occurred - Now you can modify your script for correcting the error easily.