def getfilename(package, relativeTo=None):
 if (relativeTo is None):
  relativeTo = os.getcwd()
 path = os.path.join(relativeTo, os.sep.join(package.split('.')))
 if os.path.exists((path + '/__init__.py')):
  return path
 filename = (path + '.py')
 if os.path.exists(filename):
  return filename
 return None

def getfilename ( package , relativeTo = None ) : if ( relativeTo is None ) : relativeTo = os . getcwd ( ) path = os . path . join ( relativeTo , os . sep . join ( package . split ( '.' ) ) ) if os . path . exists ( ( path + '/__init__.py' ) ) : return path filename = ( path + '.py' ) if os . path . exists ( filename ) : return filename return None
find the python source file for a package .