def getversion(fname):
 for line in open(fname):
  if line.startswith('__version__'):
   return eval(line[13:])
 raise NameError('Missing __version__ in decorator.py')

def getversion ( fname ) : for line in open ( fname ) : if line . startswith ( '__version__' ) : return eval ( line [ 13 : ] ) raise NameError ( 'Missing __version__ in decorator.py' )
get the __version__ reading the file: works both in python 2 .