Fix debugmode checking in python3
Merge pull request #2005 from nouiz/py3

[TEST fix] Fix debugmode checking in python3