parameters: (self)
return_statement: return None, None
docstring: Parse Stata's default log file and erase it if everything okay.
  
  		Parser is based on Brendan Halpin's shell script found here:
  			http://teaching.sociology.ul.ie/bhalpin/wordpress/?p=122
docstring_summary: Parse Stata's default log file and erase it if everything okay.
docstring_tokens: Parse Stata s default log file and erase it if everything okay .
function: def check_erase_log_file(self):
  		"""Parse Stata's default log file and erase it if everything okay.
  
  		Parser is based on Brendan Halpin's shell script found here:
  			http://teaching.sociology.ul.ie/bhalpin/wordpress/?p=122
  		"""
  
  		if sys.version_info.major >= 3:
  			kwargs = {'file': self.env.LOGFILEPATH, 'mode': 'r', 'encoding': self.env.STATAENCODING}
  		else:
  			kwargs = {'name': self.env.LOGFILEPATH, 'mode': 'r'}
  		with open(**kwargs) as log:
  			log_tail = log.readlines()[-10:]
  			for line in log_tail:
  				error_found = re.match(r"r\(([0-9]+)\)", line)
  				if error_found:
  					return error_found.group(1), ''.join(log_tail)
  				else:
  					pass
  		# Only end up here if the parser did not identify an error.
  		os.remove(self.env.LOGFILEPATH)
  		return None, None
function_tokens: def check_erase_log_file ( self ) : if sys . version_info . major >= 3 : kwargs = { 'file' : self . env . LOGFILEPATH , 'mode' : 'r' , 'encoding' : self . env . STATAENCODING } else : kwargs = { 'name' : self . env . LOGFILEPATH , 'mode' : 'r' } with open ( * * kwargs ) as log : log_tail = log . readlines ( ) [ - 10 : ] for line in log_tail : error_found = re . match ( r"r\(([0-9]+)\)" , line ) if error_found : return error_found . group ( 1 ) , '' . join ( log_tail ) else : pass # Only end up here if the parser did not identify an error. os . remove ( self . env . LOGFILEPATH ) return None , None