简体   繁体   中英

Difference in Exception handling py code in Odoo 11

What are differences in exception from the coding point of view in Odoo 11 as compared in Odoo 10? Can't find other differences except except Exception, e: to except Exception as e: My code shows error somehow from exception while converting a module from Odoo 10 to Odoo 11.

In Python 2.5 and earlier versions, 'as' isn't supported, so you use except Exception, e:

In Python 2.6+ versions, both can be used.

But from Python 3.x, except Exception as e is required to assign an exception to a variable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM