Does anyone know why exceptions are not always passed up the call stack when running a script from the web2py shell?

Skip to first unread message


May 25, 2023, 4:38:07 AM5/25/23
to web2py-users
(Running on Microsoft-IIS/10.0, Python 3.9.13)

I am trying to catch errors in web2py shell scripts which are run in batch, but some exceptions are not being passed up the call stack when running in shell mode.

My situation is as follows:
  1. Create the error scenario
    1. empty the languages/ in the welcome application
  2. Run a shell script using -M -R 
    1. can be a simple Hello World script
  3. Since it is a shell script, is used instead of
  4. The exception will be triggered in gluon/ in in the function read_plural_dict_aux() when executing 
    1. return eval(lang_text) or {}
  5. In this scenario, the shell script will fail but give a success return code (rc=0) because the exception is not passed up the call stack
  6. If the welcome application is run via the browser, it uses instead of and the exception is passed up the call stack and we can see the error code in the error ticket.  
I have tried catching the exception from a few different places and tried custom extensions as well, but I can't catch this exception anywhere in the call stack.

The reason I am trying to solve this is that we have batch jobs that sometimes have failed but give a success return code and so I am trying to find the root cause.  I think that this failure to capture the exceptions may be the cause.  Does anyone have any ideas as to what could be the reason for this? 

Note: If you want to see the call stack, it suffices to delete all the contents of and run the welcome app from the browser.  In the error ticket, the call stack will basically the same as the shell version as of the call to

Kind Regards,
Reply all
Reply to author
0 new messages