Hi,
I am hitting this error consistently and don't know why it's
happening. I would like to define all exceptions for my project in one
file and use them across the project. Here's a sample -
exceptions.py -
class MyException(StandardError):
def __init__(self, error):
self.myerror = error
tests.py -
from exceptions import *
class Test:
def __init__(self,filename):
if filename == "":
raise MyException("Raise custom error")
if __name__ == "__main__" :
test = Test("")
When the above is run, I get the following error -
NameError: global name 'MyException' is not defined
Thanks
loganwol