Code Monkey home page Code Monkey logo

Comments (7)

luis-valdes-21b avatar luis-valdes-21b commented on July 4, 2024 1

Try running it with Python 3.

from gitchangelog.

pylang avatar pylang commented on July 4, 2024 1

I found a workaround on Windows with Python < 3.7:

Code

Per terminal session, run:

λ set PYTHONIOENCODING="UTF-8"
λ gitchangelog

This sets a Python environ. var. to UTF-8.


Details

It seems Python 3.6 defaults to the system's encoding. On Windows 7, that encoding is CP-1252, resulting in the error described above. However, this behavior was changed in Python 3.7, which introduced PYTHONUTF8=1. 1 sets the default to UTF-8; 0 assumes the system encoding.

Thus on any system, I extend @luis-valdes-21b 's suggestion to:

try using Python 3.7+ or assign PYTHONIOENCODING="UTF-8"

Since this is a resolved Python problem, I believe this issue can be closed now.

from gitchangelog.

pylang avatar pylang commented on July 4, 2024

I'm running Python 3, but it stops writing after detecting a unicode lambda character (\u03bb) in a git commit. I get a UnicodeError too:

λ gitchangelog > CHANGELOG.md
UnicodeEncodeError:  There was a problem outputing the resulting
changelog to your console. This probably means that the changelog 
contains characters that cant be translated to characters ...

Strangely, the command alone prints in the terminal

λ gitchangelog

I just need to capture the terminal output. I wouldn't mind ignoring the unicode characters given the option.

OS: Windows 7
Python: 3.6
gitchangelog: 3.0.3+

from gitchangelog.

roseswe avatar roseswe commented on July 4, 2024

Have the same issue under openSUSE 15.1:

Error: Exception while running 'gitchangelog':
| Traceback (most recent call last):
| File "/home/ralph/bin/gitchangelog", line 1972, in main
| config.get("publish", stdout)(content)
| File "/home/ralph/bin/gitchangelog", line 1445, in stdout
| safe_print(chunk)
| File "/home/ralph/bin/gitchangelog", line 1820, in safe_print
| content = content.encode(_preferred_encoding)
| UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 38694: ordinal not in range(128)

And this is my fix:

#!/usr/bin/env python3

from gitchangelog.

pylang avatar pylang commented on July 4, 2024

@roseswe In which file did you put that shebang?

from gitchangelog.

LexiconCode avatar LexiconCode commented on July 4, 2024

Thanks everyone this solves the issue for me.

from gitchangelog.

roseswe avatar roseswe commented on July 4, 2024

Thanks everyone this solves the issue for me.

Can we expect updated sources? ;-)

@roseswe In which file did you put that shebang?

In the main python script "gitchangelog.py"

from gitchangelog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.