*When I run pylint in leo-editor: Alt X, follow error occurred:* 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 "<string>", line 1, in <module> File "leo/core/leoGlobals.py", line 1924, in run_pylint lint.Run(args) File "/usr/local/lib/python2.7/dist-packages/pylint/lint.py", line 1264, in __init__ linter.read_config_file() File "/usr/local/lib/python2.7/dist-packages/pylint/config.py", line 627, in read_config_file parser.readfp(fp) File "/usr/local/lib/python2.7/dist-packages/backports/configparser/__init__.py", line 769, in readfp self.read_file(fp, source=filename) File "/usr/local/lib/python2.7/dist-packages/backports/configparser/__init__.py", line 724, in read_file self._read(f, source) File "/usr/local/lib/python2.7/dist-packages/backports/configparser/__init__.py", line 1035, in _read for lineno, line in enumerate(fp, start=1): File "/usr/lib/python2.7/codecs.py", line 314, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) File "/usr/lib/python2.7/encodings/utf_8_sig.py", line 66, in _buffer_decode return codecs.utf_8_decode(input, errors, final) UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 2297: invalid start byte
*Simply run pylint in concole:* swot@pp:~/app$ pylint keyLog.py No config file found, using default configuration ************* Module keyLog C: 17, 0: Unnecessary parens after u'print' keyword (superfluous-parens) C: 24, 0: Unnecessary parens after u'print' keyword (superfluous-parens) C: 1, 0: Invalid module name "keyLog" (invalid-name) C: 1, 0: Missing module docstring (missing-docstring) C: 7, 0: Invalid function name "detectInputKey" (invalid-name) C: 7, 0: Missing function docstring (missing-docstring) E: 20,25: Module 'evdev.ecodes' has no 'EV_KEY' member (no-member) What's wrong with this? Anyone could help answer this ? And thanks a lot! -- 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.
#! /usr/bin/env python # -*- coding: utf-8 -*- import evdev def detectInputKey(): devices = [evdev.InputDevice(fn) for fn in evdev.list_devices()] for device in devices: print(device.fn, device.name, device.phys) dev_num = raw_input("Please select device event num: ") key_count = 0 dev = evdev.InputDevice('/dev/input/event%s' %dev_num) print(dev) for event in dev.read_loop(): if event.type == evdev.ecodes.EV_KEY: content = evdev.util.categorize(event) if "up" in "%s" %content: key_count += 1 print("KeyCount: %s --- %s" % (key_count, content)) if __name__ == '__main__': detectInputKey()