-
Notifications
You must be signed in to change notification settings - Fork 325
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
UTF-8 characters in authors leads to a crash #161
Comments
Hi. What encoding is the terminal ? You are doing errors="replace" here which works around the problem and doesn't really "solve" it. I suspect your terminal is not really set to UTF-8 and this is the actual reason for your issues. |
Hi, sorry for late reply. Encoding: Python version: Error message: Traceback (most recent call last): With the following settings, not the right character appears, but it works: Thanks, Chris |
I have the same issue beside I have UTF-8 locale
|
I would say that this could solve. Add to ~/.bash_profile
or whatever preference you want. |
@CFoltin Hi. Sorry. I forgot about this issue. In any case - it's completely normal. If your terminal can't support the character, python has no way of outputting it. The export should do the trick though. But maybe something is still not set to UTF-8. You can try setting PYTHIONIOENCODING to utf8 or redirecting to a file - in which case these problems should never occur. |
Ironically I just hit this same issue today. I don't think it's "invalid", tbh. imo gitinspector shouldn't crash just because it hits an odd character in git metadata... Traceback (most recent call last): |
There are only a few options here.
This has been discussed so many times before (and not only in this project, mind you). I think it's better to just leave it, as these exceptions are very informative in python - it's also a common issue. If you plan on outputting unicode characters you best have a terminal set up to handle it. In your case, it's configured for ascii output and you are trying to output a œ character. We actually have the following function, gitinspector/gitinspector/terminal.py Line 128 in 6d77989
This warns on mis-configured terminals that return "None" as encoding. However, it does not warn on ascii. Ascii may actually be OK if you happen to have a repo that only outputs standard ascii characters when you run gitinspector. |
Hi, Just, my 2 cents. BTW: In any case, this error message seems to be found.... |
@CFoltin i'm with you. I was thinking of using gitinspector as part of a CI pipeline that builds a custom Linux distro ... approximately 700 repos. it worked well on some samples... but then crashed our pipeline, on a linux-api-headers repo, a couple of hours into the run. Upstream folks obviously can make make their own choices about what they want to fix, but as a user I'm not interested in informative python stack-traces, I just want working software :-) Note - i've taken plenty of heat from users moaning about stack traces in my own projects :-) |
@adam-waldenberg thanks for your reply. I may be wrong but I think you missed at least a couple of options:
Crashing a whole run because of an unexpected (but valid) character in a git repo's metadata doesn't seem like correct behaviour to me |
@devcurmudgeon UTF-8 is forced on redirection. I won't be forcing UTF-8 on terminal output, because it's not always needed. Output also needs to work on other environments with extended UTF-8, UTF-16 etc. Strictly speaking, it's only author names (and sometimes filenames) that can be an issue. Again, skipping data would mean you get an invalid output, which is not an option either. @CFoltin You can only catch it once you encounter it, so even if you catch it, it would still take time before you know about it. Also, depending on what is wrong with the environment, there are a number of fixes that may or may not work. In the end, it comes down to the fact that you can't know for sure what character set you may encounter in the repository. It can even be several ones. One option I can see that I could live with is to catch it and print it out with replaced characters... We could then add a disclaimer at the end of the output stating that the output is not 100% correct and that it had to be modified in order to accommodate the terminal charset. However, I'm afraid it would raise even more questions though, as you know longer have the python exception to search on. Alternatively, the first/last exception encountered could also be included in the disclaimer. |
I have decided to catch this exception and let the error message point to some of the issues here on the project page. This should let people that run into this problem to more effectively understand it and remedy it. |
I have received a similar error: Found the solution: https://stackoverflow.com/a/57134096/1959766 |
@banbar Thank you. I don't think that Windows-specific solution has been covered anywhere on the issue tracker so far. I know it's more a Python and terminal thing than it is a gitinspector thing, but it I'm considering doing a F.A.Q/Wiki with common environment related issues that can be encountered. Maybe link into the issue tracker etc. Now and again this (or related issues) keep coming up. |
Hi,
we had names with german letters like 'ö' inside. They terminated the application on text output.
To correct the bug, I've changed line 151 in changesoutput.py to the following line:
and imported sys.
HTH, Chris
The text was updated successfully, but these errors were encountered: