################################ def func( s ): s1, s2 = s.split( ' ', 1 ) try: raise s1 except "aaaa": print 'except "aaaa"' except: print 'except:' s = "aaaa " func( s ) ################################ If I manually assign s1 with s1 = "aaaa", then it works fine! What am I doing wrong here?