def LocatePythonFile(fileName, bBrowseIfDir=1):
 if (not os.path.isfile(fileName)):
  baseName = fileName
  for path in sys.path:
   fileName = os.path.abspath(os.path.join(path, baseName))
   if os.path.isdir(fileName):
    if bBrowseIfDir:
     d = win32ui.CreateFileDialog(1, '*.py', None, 0, 'Python Files (*.py)|*.py|All files|*.*')
     d.SetOFNInitialDir(fileName)
     rc = d.DoModal()
     if (rc == win32con.IDOK):
      fileName = d.GetPathName()
      break
     else:
      return None
   else:
    fileName = (fileName + '.py')
    if os.path.isfile(fileName):
     break
  else:
   return None
 return win32ui.FullPath(fileName)

def LocatePythonFile ( fileName , bBrowseIfDir = 1 ) : if ( not os . path . isfile ( fileName ) ) : baseName = fileName for path in sys . path : fileName = os . path . abspath ( os . path . join ( path , baseName ) ) if os . path . isdir ( fileName ) : if bBrowseIfDir : d = win32ui . CreateFileDialog ( 1 , '*.py' , None , 0 , 'Python Files (*.py)|*.py|All files|*.*' ) d . SetOFNInitialDir ( fileName ) rc = d . DoModal ( ) if ( rc == win32con . IDOK ) : fileName = d . GetPathName ( ) break else : return None else : fileName = ( fileName + '.py' ) if os . path . isfile ( fileName ) : break else : return None return win32ui . FullPath ( fileName )
given a file name .