no Error Messages in imported python classes
i have a couple of python classes, which i import and use in my main program.
## path to classes
sys.path.append(basePath + "classes")
## import some classes
import mainmod
mainModHandler = mainmod.Mainmod()
I have no problem, working with them, but i wonder, if i have a error in my imported class, i do not get an error message from Python, that only works in my main.py
For example:
class Mainmod(object):
'''
this class provides some helper methods
'开发者_如何学Python''
def __init__(self, *args):
provokeAnError{} # should provoke an error message?
My python prgramm (linux commandline) does finish but not with an error message. It just stays silent. I of course use try, excepts mostly, but sometimes little errors are unavoidable.
Where or how can i tell python, to give me an error message in my imported classes?
thanks for any help! Maurice
If all you're doing is importing your module then you wouldn't get an error since that error would only happen when instantiating the class. It's unclear from your question if the code that you give as an example is the exact code you expect to produce the error.
If that isn't it, provide more context, maybe links to full files.
精彩评论