def versions_from_file(filename):
 try:
  with open(filename) as f:
   contents = f.read()
 except EnvironmentError:
  raise NotThisMethod('unable to read _version.py')
 mo = re.search("version_json = '''\\n(.*)'''  # END VERSION_JSON", contents, (re.M | re.S))
 if (not mo):
  raise NotThisMethod('no version_json in _version.py')
 return json.loads(mo.group(1))

def versions_from_file ( filename ) : try : with open ( filename ) as f : contents = f . read ( ) except EnvironmentError : raise NotThisMethod ( 'unable to read _version.py' ) mo = re . search ( "version_json = '''\\n(.*)'''  # END VERSION_JSON" , contents , ( re . M | re . S ) ) if ( not mo ) : raise NotThisMethod ( 'no version_json in _version.py' ) return json . loads ( mo . group ( 1 ) )
try to determine the version from _version .