Skip to content

Conversation

FriedrichFroebel
Copy link
Collaborator

This fixes the blocks test by setting the UTF-8 encoding when opening the JSON file. Otherwise the corresponding test may fail on Windows because the default encoding (in my case CP-1252) is used which cannot handle some of the characters:

======================================================================
ERROR: Parse locally stored grid and compare to expected results
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Python\lib\unittest\mock.py", line 1195, in patched
    return func(*args, **keywargs)
  File "C:\Me\GitHub\pycaching\test\test_geo.py", line 207, in test_blocks
    mock_utfgrid.return_value = json.load(f)
  File "C:\Python\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
  File "C:\Python\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 1346: character maps to <undefined>

Copy link
Owner

@tomasbedrich tomasbedrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a noob mistake. :) Thanks!

@FriedrichFroebel FriedrichFroebel merged commit 009e540 into tomasbedrich:master Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants