fireplace
fireplace copied to clipboard
Test fails
I installed fireplace and tests get this errors
System: Windows 10 Pro x64 Python 3.6
test_auchenai_soulpriest.py:1: in <module>
from utils import *
utils.py:63: in <module>
_heroes = fireplace.cards.filter(collectible=True, type=CardType.HERO)
C:\Program Files (x86)\Python36-32\lib\site-packages\fireplace-0.1-py3.6.egg\fireplace\cards\__init__.py:109: in filter
self.initialize()
C:\Program Files (x86)\Python36-32\lib\site-packages\fireplace-0.1-py3.6.egg\fireplace\cards\__init__.py:90: in initialize
db, xml = cardxml.load()
C:\Program Files (x86)\Python36-32\lib\site-packages\hearthstone\cardxml.py:346: in load
xml = ElementTree.parse(f)
C:\Program Files (x86)\Python36-32\lib\xml\etree\ElementTree.py:1196: in parse
tree.parse(source, parser)
C:\Program Files (x86)\Python36-32\lib\xml\etree\ElementTree.py:597: in parse
self._root = parser._parse_whole(source)
C:\Program Files (x86)\Python36-32\lib\encodings\cp1251.py:23: in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
E UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 1158: character maps to <undefined>
------------------------------- Captured stderr -------------------------------
[fireplace.__init__]: Initializing card database
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!
=========================== 1 error in 4.05 seconds ===========================
hi this is an issue with python-hearthstone but to fix this, you can dive into your env's site packages (env\lib\site-packages\hearthstone
) and edit to fix it.
go to line 345 in cardxml.py
and change the line to:
with open(path, "r", encoding="utf-8") as f:
This changes the encoding that python will open the file with and bypass this error. Gotta do this everytime you upgrade the hearthstone dependency on windows until they decide to drop py2 support
python-hearthstone
should require Python 3.4+, so I'm not sure why that's happening...
I had to remove the encoding
parameter in python-hearthstone. We do use it on Python 2 because of AWS Lambda.
python 2 is deprecated