<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 27, 2019 at 12:23 PM Bas Couwenberg <<a href="mailto:sebastic@xs4all.nl">sebastic@xs4all.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Control: tags -1 + moreinfo<br>
Control: tags -1 - d-i<br>
<br>
On 2019-08-27 11:52, Marek Lukács wrote:<br>
> MapProxy does not work on Python 3.7 installs. I figured out two <br>
> issues,<br>
> one related to Debian installation (directory structure) and other to<br>
> upstream known issue:<br>
> <br>
> 1. Directory structure<br>
> <br>
> Debian moves templates into /usr/share/python3-mapproxy/, but default<br>
> template_dir variable is not changed, so Python looks for templates<br>
> instead in /usr/lib/python3/dist-packages/mapproxy/.<br>
> <br>
> How to fix:<br>
> change default directory in<br>
> /usr/lib/python3/dist-packages/mapproxy/config/defaults.py<br>
<br>
What is the actual issue you experience?<br></blockquote><div><br></div><div>Not working, failing with error:<br></div><div><br></div><div>fatal error in demo for /demo/?<br>Traceback (most recent call last):<br> File "/usr/lib/python3/dist-packages/mapproxy/wsgiapp.py", line 193, in __call__<br> resp = self.handlers[handler_name].handle(req)<br> File "/usr/lib/python3/dist-packages/mapproxy/service/demo.py", line 121, in handle<br> demo = self._render_template('demo/demo.html')<br> File "/usr/lib/python3/dist-packages/mapproxy/service/demo.py", line 161, in _render_template<br> template = get_template(template, default_inherit="demo/static.html")<br> File "/usr/lib/python3/dist-packages/mapproxy/template.py", line 36, in __call__<br> default_inherit=default_inherit, get_template=self)<br> File "/usr/lib/python3/dist-packages/mapproxy/util/ext/tempita/__init__.py", line 135, in from_filename<br> f = open(filename, 'rb')<br>FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib/python3/dist-packages/mapproxy/service/templates/demo/demo.html'<br>Traceback (most recent call last):<br> File "/usr/lib/python3/dist-packages/mapproxy/wsgiapp.py", line 193, in __call__<br> resp = self.handlers[handler_name].handle(req)<br> File "/usr/lib/python3/dist-packages/mapproxy/service/demo.py", line 121, in handle<br> demo = self._render_template('demo/demo.html')<br> File "/usr/lib/python3/dist-packages/mapproxy/service/demo.py", line 161, in _render_template<br> template = get_template(template, default_inherit="demo/static.html")<br> File "/usr/lib/python3/dist-packages/mapproxy/template.py", line 36, in __call__<br> default_inherit=default_inherit, get_template=self)<br> File "/usr/lib/python3/dist-packages/mapproxy/util/ext/tempita/__init__.py", line 135, in from_filename<br> f = open(filename, 'rb')<br>FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib/python3/dist-packages/mapproxy/service/templates/demo/demo.html' <br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Do you have custom templates?<br></blockquote><div><br></div><div>No</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
The directories moved to /usr/share/python3-mapproxy are symlinked fro <br>
/usr/lib/python3/dist-packages/mapproxy:<br>
<br>
lrwxrwxrwx root/root 0 2019-08-06 13:00 <br>
./usr/lib/python3/dist-packages/mapproxy/service/templates -> <br>
../../../../../share/python3-mapproxy/service/templates<br>
lrwxrwxrwx root/root 0 2019-08-06 13:00 <br>
./usr/lib/python3/dist-packages/mapproxy/test/schemas -> <br>
../../../../../share/python3-mapproxy/test/schemas<br>
lrwxrwxrwx root/root 0 2019-08-06 13:00 <br>
./usr/lib/python3/dist-packages/mapproxy/test/system/fixture/cache_data <br>
-> <br>
../../../../../../../share/python3-mapproxy/test/system/fixture/cache_data<br>
<br>
As long as custom templates are installed in <br>
/usr/share/python3-mapproxy/service/templates they should work.<br></blockquote><div><br></div><div>
Do not have symlink in my case. Symlink can fix the issue as well. <br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
How can I reproduce your issue with with templates?<br></blockquote><div><br></div><div></div><div>On Debian Buster install package python3-mapproxy, configure services and start it. It will not work, as on Debian Buster (at least in my case) there is no symlink to templates in dist-packages.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> 2. Upstream code is not compatible with Python 3.7<br>
> <br>
> Tempia does not correctly parses function signature with recent Python<br>
> versions. Likely introduced with changes in Python tokenizer package<br>
> with 3.6.7. Use keyword args as workaround.<br>
> <br>
> This is already known bug in upstream:<br>
> <a href="https://github.com/mapproxy/mapproxy/commit/81c84d47bbc77da324c36ca718fbca7dde1c1c66" rel="noreferrer" target="_blank">https://github.com/mapproxy/mapproxy/commit/81c84d47bbc77da324c36ca718fbca7dde1c1c66</a><br>
> <br>
> How to fix:<br>
> Patch according to commit<br>
> <a href="https://github.com/mapproxy/mapproxy/commit/81c84d47bbc77da324c36ca718fbca7dde1c1c66" rel="noreferrer" target="_blank">https://github.com/mapproxy/mapproxy/commit/81c84d47bbc77da324c36ca718fbca7dde1c1c66</a><br>
<br>
We can cherry-pick this commit and include it as a patch, as a new <br>
mapproxy releases will likely take some time.<br>
<br>
How can I reproduce the issue you experience with Python 3.7?<br></blockquote><div><br></div><div>Just install python3-mapproxy package, configure mapproxy and request for XML capabilities. It will result in error:</div><div><br></div><div>TypeError: Extra position arguments: True at line 169 column 3 in file /usr/share/python3-mapproxy/service/templates/wms111capabilities.xml<br>Traceback (most recent call last):<br> File "/usr/lib/python3/dist-packages/mapproxy/wsgiapp.py", line 193, in __call__<br> resp = self.handlers[handler_name].handle(req)<br> File "/usr/lib/python3/dist-packages/mapproxy/service/ows.py", line 38, in handle<br> return self.services[service].handle(req)<br> File "/usr/lib/python3/dist-packages/mapproxy/service/base.py", line 30, in handle<br> return handler(parsed_req)<br> File "/usr/lib/python3/dist-packages/mapproxy/service/wms.py", line 196, in capabilities<br> ).render(map_request)<br> File "/usr/lib/python3/dist-packages/mapproxy/service/wms.py", line 516, in render<br> return self._render_template(_map_request.capabilities_template)<br> File "/usr/lib/python3/dist-packages/mapproxy/service/wms.py", line 531, in _render_template<br> inspire_md=inspire_md,<br> File "/usr/lib/python3/dist-packages/mapproxy/util/ext/tempita/__init__.py", line 167, in substitute<br> result, defs, inherit = self._interpret(ns)<br> File "/usr/lib/python3/dist-packages/mapproxy/util/ext/tempita/__init__.py", line 178, in _interpret<br> self._interpret_codes(self._parsed, ns, out=parts, defs=defs)<br> File "/usr/lib/python3/dist-packages/mapproxy/util/ext/tempita/__init__.py", line 206, in _interpret_codes<br> self._interpret_code(item, ns, out, defs)<br> File "/usr/lib/python3/dist-packages/mapproxy/util/ext/tempita/__init__.py", line 226, in _interpret_code<br> base = self._eval(parts[0], ns, pos)<br> File "/usr/lib/python3/dist-packages/mapproxy/util/ext/tempita/__init__.py", line 301, in _eval<br> reraise((exc_info[0], e, exc_info[2]))<br> File "/usr/lib/python3/dist-packages/mapproxy/util/py.py", line 40, in reraise<br> raise exc.with_traceback(tb)<br> File "/usr/lib/python3/dist-packages/mapproxy/util/ext/tempita/__init__.py", line 288, in _eval<br> value = eval(code, self.default_namespace, ns)<br> File "<string>", line 1, in <module><br> File "/usr/lib/python3/dist-packages/mapproxy/util/ext/tempita/__init__.py", line 519, in __call__<br> values = self._parse_signature(args, kw)<br> File "/usr/lib/python3/dist-packages/mapproxy/util/ext/tempita/__init__.py", line 562, in _parse_signature<br> % ', '.join(repr(v) for v in args))<br>TypeError: Extra position arguments: True at line 169 column 3 in file /usr/share/python3-mapproxy/service/templates/wms111capabilities.xml</div><div><br></div><div>Do you need to prepare sample configuration for you? I can do simple copy of my configuration with for example single layer/service.</div><div><br></div><div>Regards,</div><div><br></div><div>Marek<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Kind Regards,<br>
<br>
Bas<br>
</blockquote></div></div>