pysolr icon indicating copy to clipboard operation
pysolr copied to clipboard

run-tests: script crashes with C locale due to unicode chars being printed

Open mgorny opened this issue 5 years ago • 1 comments

I have

  • [x] Tested with the latest release
  • [x] Tested with the current master branch
  • [x] Searched for similar existing issues

Expected behaviour

Test script exits successfully.

Actual behaviour

Test script crashes after tests succeed:

Ran 106 tests in 40.806s

OK
Traceback (most recent call last):
  File "run-tests.py", line 28, in <module>
    main()
  File "run-tests.py", line 23, in main
    print("Tests complete; halting Solr servers…")
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 36: ordinal not in range(128)

Steps to reproduce the behaviour

  1. export LC_ALL=C
  2. python2.7 run-tests.py

Configuration

  • Operating system version: Gentoo Linux
  • Search engine version: apparently 4.10.4 gets fetched for tests
  • Python version: 2.7.16
  • pysolr version: git master

mgorny avatar Aug 10 '19 08:08 mgorny

Can you run it using PYTHONIOENCODING=utf-8:surrogateescape? UTF-8 has been around since the mid-90s and I've left that in there as a canary for misconfigured environments since that tends to correlate with other problems (e.g. any error handling path which displays non-ASCII content).

acdha avatar Aug 23 '19 14:08 acdha