def __error(self,msg='invalid syntax'):
        pos = self._tokens[self._tokenX][2]
        import traceback, StringIO
        f = StringIO.StringIO()
        traceback.print_exc(file=f)
        f = f.getvalue()
        m = 'File "<string>", line '
        i = f.rfind('File "<string>", line ')
        if i<0:
            t, v = map(str,sys.exc_info()[:2])
            self.__lexerror('%s %s(%s)' % (msg, t, v),pos)
        else:
            i += len(m)
            f = f[i:].split('\n')
            n = int(f[0].strip())+self.source[:pos].count('\n')
            raise SyntaxError('  File %s, line %d\n%s' % (self.filename,n,'\n'.join(f[1:])))
dataset/ETHPy150Open CGATOxford/cgat/obsolete/preppy.py/PreppyParser.__error/original