Show warning when a class is imported in python

前端 未结 4 966
臣服心动
臣服心动 2021-01-13 11:52

I have a class in a different module and I want to show a DeprecationWarning when that class is imported. What will be the right way to do so?

module 1

4条回答
  •  甜味超标
    2021-01-13 12:01

    Add this code to your index page:

    error_reporting(1);
    ini_set('display_startup_errors', 0);
    

提交回复
热议问题