keombre / python-eet

Czech EET API for python
https://pypi.org/project/czech-eet/
MIT License
3 stars 0 forks source link

Missing soap_template.xml file #1

Closed prochac closed 4 years ago

prochac commented 4 years ago

Hi, the file soap_template.xml is missing if library download by pip.

Traceback (most recent call last):
  File "/home/tom/Workspace/Python/andreja-mvp/cli.py", line 45, in <module>
    response = invoice.send()
  File "/home/tom/Workspace/Python/andreja-mvp/venv/lib/python3.8/site-packages/eet/invoices.py", line 126, in send
    return remote.Scheduler.send(self)
  File "/home/tom/Workspace/Python/andreja-mvp/venv/lib/python3.8/site-packages/eet/remote.py", line 31, in send
    xml = invoice.build()
  File "/home/tom/Workspace/Python/andreja-mvp/venv/lib/python3.8/site-packages/eet/invoices.py", line 123, in build
    return self._buildXml()
  File "/home/tom/Workspace/Python/andreja-mvp/venv/lib/python3.8/site-packages/eet/invoices.py", line 94, in _buildXml
    return binding.Soap(self._config.cert(), self._config.private_key()).build(self)
  File "/home/tom/Workspace/Python/andreja-mvp/venv/lib/python3.8/site-packages/eet/binding.py", line 100, in build
    return etree.tostring(self._build_envelope(self._build_data_element(sale)))
  File "/home/tom/Workspace/Python/andreja-mvp/venv/lib/python3.8/site-packages/eet/binding.py", line 124, in _build_envelope
    tree = etree.parse(str(Path(__file__).parent.absolute().joinpath('soap_template.xml')), parser)
  File "src/lxml/etree.pyx", line 3519, in lxml.etree.parse
  File "src/lxml/parser.pxi", line 1839, in lxml.etree._parseDocument
  File "src/lxml/parser.pxi", line 1865, in lxml.etree._parseDocumentFromURL
  File "src/lxml/parser.pxi", line 1769, in lxml.etree._parseDocFromFile
  File "src/lxml/parser.pxi", line 1163, in lxml.etree._BaseParser._parseDocFromFile
  File "src/lxml/parser.pxi", line 601, in lxml.etree._ParserContext._handleParseResultDoc
  File "src/lxml/parser.pxi", line 711, in lxml.etree._handleParseResult
  File "src/lxml/parser.pxi", line 638, in lxml.etree._raiseParseError
OSError: Error reading file '/home/tom/Workspace/Python/andreja-mvp/venv/lib/python3.8/site-packages/eet/soap_template.xml': failed to load external entity "/home/tom/Workspace/Python/andreja-mvp/venv/lib/python3.8/site-packages/eet/soap_template.xml"

Reproduction:

#!/bin/bash
VERSION=$(python -c 'import sys; print("{v[0]}.{v[1]}".format(v=sys.version_info[:2]))')
echo "Using Python "$VERSION

echo "Preparing environment"

mkdir -p /tmp/czech-eet-issue-1
cd /tmp/czech-eet-issue-1
python3 -m venv venv
. venv/bin/activate
pip install czech-eet 1>/dev/null

echo
echo "everything is prepared, let's find out file:"
echo "venv/lib/python$VERSION/site-packages/eet/soap_template.xml"
echo
ls venv/lib/python$VERSION/site-packages/eet
keombre commented 4 years ago

fixed in version 1.0.3 you can upgrade by running pip install czech-eet --upgrade --no-cache-dir to force the download of the newest version.

prochac commented 4 years ago

Thank you, sir.