question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Decoding error on license file on macOS

See original GitHub issue

Same issue as #35 and #37 but on macOS with a standard Python 3 install, not in a docker container.

Tested on 1.16.1.

$ pip-licenses --from=mixed --with-system --format=rst --with-license-file
Traceback (most recent call last):
  File "/Users/user/proj/.tox/licenses/bin/pip-licenses", line 8, in <module>
    sys.exit(main())
  File "/Users/user/proj/.tox/licenses/site-packages/piplicenses.py", line 638, in main
    print(output_string)
  File "/Users/user/proj/.tox/licenses/lib-python/3/encodings/ascii.py", line 22, in encode
    return codecs.ascii_encode(input, self.errors)[0]
UnicodeEncodeError: 'ascii' codec can't encode character '\xa9' in position 167881: ordinal not in range(128)

Python prompt for reference:

$ python
Python 3.6.9 (5da45ced70e5, Oct 09 2019, 19:13:07)
[PyPy 7.2.0 with GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
raimon49commented, Dec 12, 2019

I add to the documentation as a frequently asked question about UnicodeEncodeError.

Your report was very helpful. Thanks a lot!

1reaction
johnthagencommented, Dec 11, 2019
[testenv]
passenv= LC_CTYPE

fixed it, thanks!

Still strange though. I suppose that it’s because tox doesn’t bring in any ENV variables by default. But, then again lots of Python programs can read Unicode files from within tox, so I wonder if there is a way to make pip-licenses work out of the box? It seems like if it’s reading arbitrary license files from PyPI it shouldn’t really need to assume the user has a certain locale?

Hmm, not sure, but really appreciate the fix!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Decoding Error when reading license file. · Issue #35 - GitHub
I ran pip-licenses inside a docker container of mine, and got the following exception: Traceback (most recent call last): File ...
Read more >
macOS - License Verification Error License missing its DBInfo
macOS – Authorization error in macOS – License Verification Error License missing its DBInfo. After a Time Machine file restores in macOS you ......
Read more >
Why am I being told "the license file selected appears to be ...
ERROR: The license file selected appears to be invalid. However, the license file I got was sent directly from MathWorks. How can I...
Read more >
License decoding failed or License was not accepted error
When I attempt to install a license file for an add on, I see a "License decoding failed" or "License was not accepted"...
Read more >
"The file could not be read. It may be corrupt or not licensed ...
1. You're using a file from a Pack which needs to be unlocked · 2. You're using an outdated version of Live on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found