Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while setting log level #1938

Closed
clubby789 opened this issue Jul 27, 2021 · 0 comments · Fixed by #1939
Closed

Error while setting log level #1938

clubby789 opened this issue Jul 27, 2021 · 0 comments · Fixed by #1939

Comments

@clubby789
Copy link
Contributor

clubby789 commented Jul 27, 2021

from pwn import *
context.log_level = 'silent'
Traceback (most recent call last):
  File "/tmp/test.py", line 3, in <module>
    context.log_level = 'silent'
  File "/usr/local/lib/python3.9/dist-packages/pwnlib/context/__init__.py", line 173, in fset
    self._tls[name] = validator(self, val)
  File "/usr/local/lib/python3.9/dist-packages/pwnlib/context/__init__.py", line 974, in log_level
    level_names = filter(lambda x: isinstance(x,str), logging._levelNames)
AttributeError: module 'logging' has no attribute '_levelNames'

This appears to be left over from Python 2's logging module, which had logging._levelNames:
{0: 'NOTSET', 10: 'DEBUG', 'WARN': 30, 20: 'INFO', 'ERROR': 40, 'DEBUG': 10, 30: 'WARNING', 'INFO': 20, 'WARNING': 30, 40: 'ERROR', 50: 'CRITICAL', 'CRITICAL': 50, 'NOTSET': 0}.

Python3 has logging._levelToName: {50: 'CRITICAL', 40: 'ERROR', 30: 'WARNING', 20: 'INFO', 10: 'DEBUG', 0: 'NOTSET'}

Ironically erroring 2 lines before throwing an error

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

Successfully merging a pull request may close this issue.

1 participant