traceback.print_exec() returns None which causes ugly error message
Hello @dbeltran and @bdepaula,
Autosubmit Version
4.0.84 and 4.0.87 (but probably all of them, even 3.0)
Summary
There is a None
when printing out the error message that appears when the database is not able to be opened by Autosubmit. I noticed this in the context of the docker image of Autosubmit, when the binded database did not allow the containerized autosubmit to read the database, it output the error with "Noneunable" typo (check logs afterwards)
Steps to reproduce
I managed to reproduce outside of the container by running autosubmit install
and placing a break point at line 3956, which is if not create_db(qry):
. At that point I just change the name of the file where the database is stored and continue the execution.
What is the current bug behavior?
/home/mgimenez/.venv/python3.8-AS4/bin/python /snap/pycharm-community/342/plugins/python-ce/helpers/pydev/pydevd.py --multiprocess --qt-support=auto --client 127.0.0.1 --port 44067 --file /home/mgimenez/Documents/local/dev/autosubmit/bin/autosubmit install
Connected to pydev debugger (build 232.8660.197)
Creating autosubmit database...
[ERROR] Trace: unable to open database file
Traceback (most recent call last):
File "/home/mgimenez/Documents/local/dev/autosubmit/bin/autosubmit", line 36, in main
Autosubmit.parse_args()
File "/home/mgimenez/Documents/local/dev/autosubmit/autosubmit/autosubmit.py", line 700, in parse_args
return Autosubmit.install()
File "/home/mgimenez/Documents/local/dev/autosubmit/autosubmit/autosubmit.py", line 3956, in install
if not create_db(qry):
File "/home/mgimenez/Documents/local/dev/autosubmit/autosubmit/database/db_common.py", line 42, in create_db
(conn, cursor) = open_conn(False)
File "/home/mgimenez/Documents/local/dev/autosubmit/autosubmit/database/db_common.py", line 81, in open_conn
conn = sqlite3.connect(BasicConfig.DB_PATH)
sqlite3.OperationalError: unable to open database file
[CRITICAL] Noneunable to open database file
Unhandled error: If you see this message, please report it in Autosubmit's GitLab project
What is the expected correct behavior?
/home/mgimenez/.venv/python3.8-AS4/bin/python /snap/pycharm-community/342/plugins/python-ce/helpers/pydev/pydevd.py --multiprocess --qt-support=auto --client 127.0.0.1 --port 44067 --file /home/mgimenez/Documents/local/dev/autosubmit/bin/autosubmit install
Connected to pydev debugger (build 232.8660.197)
Creating autosubmit database...
[ERROR] Trace: unable to open database file
Traceback (most recent call last):
File "/home/mgimenez/Documents/local/dev/autosubmit/bin/autosubmit", line 36, in main
Autosubmit.parse_args()
File "/home/mgimenez/Documents/local/dev/autosubmit/autosubmit/autosubmit.py", line 700, in parse_args
return Autosubmit.install()
File "/home/mgimenez/Documents/local/dev/autosubmit/autosubmit/autosubmit.py", line 3956, in install
if not create_db(qry):
File "/home/mgimenez/Documents/local/dev/autosubmit/autosubmit/database/db_common.py", line 42, in create_db
(conn, cursor) = open_conn(False)
File "/home/mgimenez/Documents/local/dev/autosubmit/autosubmit/database/db_common.py", line 81, in open_conn
conn = sqlite3.connect(BasicConfig.DB_PATH)
sqlite3.OperationalError: unable to open database file
[CRITICAL] unable to open database file
Unhandled error: If you see this message, please report it in Autosubmit's GitLab project
Any other relevant information
I thought this was a matter of just going through the error messages that Autosubmit throws and fix the typo. But I think this is due to the line 67's at /bin/autosubmit.py
where there is some formating happening. I don't know why the traceback.print_exc()
is returning None
in this case.
Maybe we can very lazily check if it returns None
then not print it.
Log.critical(
"{1}{0}\nUnhandled error: If you see this message, please report it in Autosubmit's GitLab project".format(str(e),str(traceback.print_exc())
), 7000)