#!/usr/bin/env python
#import re
def test_ex1(input):
    if re.match(r'^[A-Z]+$',input):
        print 'Match'
        return True
    print 'No Match'
    return False   
#test_ex1('ABC')
try:
    test_ex1('ABC')
except Exception:
    raise Exception
If I run the above program,it will print following exception message.
a:~/Python> python test.py
Traceback (most recent call last):
  File "test.py", line 18, in <module>
    raise Exception
Exception
What is the right way in Python to make it print the following stack trace while catching exception using try except without changing test_ex1 subroutine?
Traceback (most recent call last):
  File "test.py", line 15, in <module>
    test_ex1('ABC')
  File "test.py", line 8, in test_ex1
    if re.match(r'^[A-Z]+$',input):
NameError: global name 're' is not defined
 
     
     
    