def CheckFile():
 try:
  pathName = GetActiveFileName()
 except KeyboardInterrupt:
  return
 what = 'check'
 win32ui.SetStatusText((what.capitalize() + 'ing module...'), 1)
 win32ui.DoWaitCursor(1)
 try:
  f = open(pathName)
 except IOError as details:
  print ("Cant open file '%s' - %s" % (pathName, details))
  return
 try:
  code = (f.read() + '\n')
 finally:
  f.close()
 try:
  codeObj = compile(code, pathName, 'exec')
  if RunTabNanny(pathName):
   win32ui.SetStatusText((("Python and the TabNanny successfully checked the file '" + os.path.basename(pathName)) + "'"))
 except SyntaxError:
  _HandlePythonFailure(what, pathName)
 except:
  traceback.print_exc()
  _HandlePythonFailure(what)
 win32ui.DoWaitCursor(0)

def CheckFile ( ) : try : pathName = GetActiveFileName ( ) except KeyboardInterrupt : return what = 'check' win32ui . SetStatusText ( ( what . capitalize ( ) + 'ing module...' ) , 1 ) win32ui . DoWaitCursor ( 1 ) try : f = open ( pathName ) except IOError as details : print ( "Cant open file '%s' - %s" % ( pathName , details ) ) return try : code = ( f . read ( ) + '\n' ) finally : f . close ( ) try : codeObj = compile ( code , pathName , 'exec' ) if RunTabNanny ( pathName ) : win32ui . SetStatusText ( ( ( "Python and the TabNanny successfully checked the file '" + os . path . basename ( pathName ) ) + "'" ) ) except SyntaxError : _HandlePythonFailure ( what , pathName ) except : traceback . print_exc ( ) _HandlePythonFailure ( what ) win32ui . DoWaitCursor ( 0 )
this code looks for the current window .