prevent exception in PyCharm debug console