Would you tell me which line like plain ascii? error == [], when I run your script both wiht pylint-leo-rc.txt and my py file.
在 2016年10月16日星期日 UTC+8上午9:10:38,Edward K. Ream写道: > > > On Fri, Oct 14, 2016 at 6:16 AM, zhaohe wang <wangz...@gmail.com >> <javascript:>> wrote: >> >>> Leo 5.4-devel, build 20160722143100, Fri, Jul 22, 2016 2:31:00 PM >>> Git repo info: branch = master, commit = cb40bc3b4ca7 >>> Python 2.7.12, PyQt version 4.8.7 >>> linux2 >>> pylint: keyLog.py >>> Traceback (most recent call last): >>> >> >> File >>> "/usr/local/lib/python2.7/dist-packages/backports/configparser/__init__.py", >>> >>> line 1101, in _read >>> raise MissingSectionHeaderError(fpname, lineno, line) >>> backports.configparser.MissingSectionHeaderError: File contains no >>> section headers. >>> file: '/home/swot/leo-editor/leo/test/pylint-leo-rc.txt', line: 1 >>> u'@first # -*- coding: utf-8 -*-\n' >>> pylint: done 0.23 sec. >>> >> >> Not sure what is happening. You might try removing non-ascii characters >> from the file. >> > > The same kind of thing happened to me today after upgrading my Python > distribution. > > To find the location of the problem, I wrote this script: > > path = r'c:\leo.repo\leo-editor\leo\test\pylint-leo-rc.txt' > f = open(path) > s = f.read() > f.close() > print(len(s)) > errors = [] > n = 0 > for i, line in enumerate(g.splitLines(s)): > try: > print(' %3s %4s %s' % (i+1, n, line.rstrip())) > except UnicodeEncodeError: > print('**%3s %4s %s' % (i+1, n, len(line.rstrip()))) > errors.append(i) > n += len(line) > print('error lines: %s' % errors) > > The line *looked* like plain ascii, but removing it solved the problem. > This was a strange one. > > Edward > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.