Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

日志编码错误 #1391

Open
billgavin opened this issue Jun 19, 2020 · 1 comment
Open

日志编码错误 #1391

billgavin opened this issue Jun 19, 2020 · 1 comment

Comments

@billgavin
Copy link

运行环境 ubuntu16.04 python3.5
--- Logging error ---
Traceback (most recent call last):
File "/root/cobra/cobra/log.py", line 67, in stdout_encode
ret = data.encode(sys.stdout.encoding)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 786-793: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/cobra/cobra/log.py", line 117, in emit
message = stdout_encode(self.format(record))
File "/root/cobra/cobra/log.py", line 69, in stdout_encode
ret = data.encode(UNICODE_ENCODING) if isinstance(data, unicode) else data
NameError: name 'unicode' is not defined
Call stack:
File "cobra/cobra.py", line 22, in
sys.exit(main())
File "/root/cobra/cobra/init.py", line 110, in main
cli.start(args.target, args.format, args.output, args.special_rules, a_sid, args.dels)
File "/root/cobra/cobra/cli.py", line 94, in start
language=main_language, framework=main_framework, file_count=file_count, extension_count=len(files))
File "/root/cobra/cobra/engine.py", line 243, in scan
logger.info("[SCAN] Trigger Rules/Not Trigger Rules/Off Rules: {tr}/{ntr}/{fr} Vulnerabilities ({vn})\r\n{table}".format(tr=len(trigger_rules), ntr=len(diff_rules), fr=off_rules, vn=len(find_vulnerabilities), table=table))
File "/usr/lib64/python3.6/logging/init.py", line 1308, in info
self._log(INFO, msg, args, **kwargs)
File "/usr/lib64/python3.6/logging/init.py", line 1444, in _log
self.handle(record)
File "/usr/lib64/python3.6/logging/init.py", line 1454, in handle
self.callHandlers(record)
File "/usr/lib64/python3.6/logging/init.py", line 1516, in callHandlers
hdlr.handle(record)
File "/usr/lib64/python3.6/logging/init.py", line 865, in handle
self.emit(record)
File "/root/cobra/cobra/log.py", line 134, in emit
self.handleError(record)

@zero4703
Copy link

zero4703 commented Sep 3, 2020

临时切换下本地语言,再执行试下?
LANG=C.UTF-8

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants