-
Notifications
You must be signed in to change notification settings - Fork 118
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
If error msg contains a curly bracket, log will fail when attempting to use format #188
Comments
Interesting. Can you provide a minimal code sample that shows the error? |
This is a very simple use case, I imagine there could be others:
python3 raises a syntax error: Radon can't capture the error because while doing so it has its own error: Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/radon/__init__.py", line 15, in main
program()
File "/usr/local/lib/python3.7/site-packages/mando/core.py", line 201, in __call__
return self.execute(sys.argv[1:])
File "/usr/local/lib/python3.7/site-packages/mando/core.py", line 197, in execute
return command(*a)
File "/usr/local/lib/python3.7/site-packages/radon/cli/__init__.py", line 119, in cc
stream=stream)
File "/usr/local/lib/python3.7/site-packages/radon/cli/__init__.py", line 321, in log_result
log_error(h_args[0], indent=1)
File "/usr/local/lib/python3.7/site-packages/radon/cli/__init__.py", line 353, in log_error
log('{0}{1}ERROR{2}: {3}'.format(BRIGHT, RED, RESET, msg), *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/radon/cli/__init__.py", line 338, in log
m = msg if kwargs.get('noformat', False) else msg.format(*args)
ValueError: Single '}' encountered in format string
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/radon", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.7/site-packages/radon/__init__.py", line 17, in main
log_error(e)
File "/usr/local/lib/python3.7/site-packages/radon/cli/__init__.py", line 353, in log_error
log('{0}{1}ERROR{2}: {3}'.format(BRIGHT, RED, RESET, msg), *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/radon/cli/__init__.py", line 338, in log
m = msg if kwargs.get('noformat', False) else msg.format(*args)
ValueError: Single '}' encountered in format string``` |
Generalizing this issue, any error that happens during parsing, that throws an error with a curly bracket in its message, radon is likely to fail instead of capturing that error. |
I have a syntax error in a file that is involves an error message with a curly bracket:
The msg here:
radon/radon/cli/__init__.py
Line 353 in 8db8eac
I imagine contains the curly bracket which causes an issue at the format call here:
radon/radon/cli/__init__.py
Line 338 in 8db8eac
The text was updated successfully, but these errors were encountered: