[Python-modules-team] Bug#962322: python3-cherrypy3: application config loading from file fails

spreng debian-bugs at m.spreng.ch
Sat Jun 6 09:49:34 BST 2020


Package: python3-cherrypy3
Version: 8.9.1-6
Severity: important

Dear Maintainer,

I have a small cherrypy application with a separate configuration file.
During the loading of the configuration file I get following error:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cherrypy/lib/reprconf.py", line 213, in
as_dict
    value = unrepr(value)
  File "/usr/lib/python3/dist-packages/cherrypy/lib/reprconf.py", line 518, in
unrepr
    return b.build(obj)
  File "/usr/lib/python3/dist-packages/cherrypy/lib/reprconf.py", line 359, in
build
    raise TypeError('unrepr does not recognize %s' %
TypeError: unrepr does not recognize 'Constant'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tut.py", line 8, in <module>
    cherrypy.quickstart(Root(), '/', "app.conf")
  File "/usr/lib/python3/dist-packages/cherrypy/__init__.py", line 180, in
quickstart
    _global_conf_alias.update(config)
  File "/usr/lib/python3/dist-packages/cherrypy/_cpconfig.py", line 158, in
update
    reprconf.Config.update(self, config)
  File "/usr/lib/python3/dist-packages/cherrypy/lib/reprconf.py", line 155, in
update
    config = Parser().dict_from_file(config)
  File "/usr/lib/python3/dist-packages/cherrypy/lib/reprconf.py", line 228, in
dict_from_file
    return self.as_dict()
  File "/usr/lib/python3/dist-packages/cherrypy/lib/reprconf.py", line 219, in
as_dict
    raise ValueError(msg, x.__class__.__name__, x.args)
ValueError: ("Config error in section: '/', option: 'test', value: 'True'.
Config values must be valid Python.", 'TypeError', ("unrepr does not recognize
'Constant'",))

The same simple example works on older versions of Debian, and it also
works when I use cherrypy from pip (18.6.0)
The example:

test.py:
import cherrypy

class Root(object):
    @cherrypy.expose
    def index(self):
        return "hello world!"

cherrypy.quickstart(Root(), '/', "app.conf")
-End of File-

app.conf:
[/]
test: True
-End of File-

- Including the configuration in the python code works
- A newer version of cherrypy from pip works
- It might be a problem with that specific version of cherrypy, even
  though I was not able to find a corresponding bug.




-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 5.6.0-2-amd64 (SMP w/12 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages python3-cherrypy3 depends on:
ii  python3      3.8.2-3
ii  python3-six  1.15.0-1

Versions of packages python3-cherrypy3 recommends:
ii  python3-openssl     19.1.0-2
ii  python3-routes      2.4.1-2
ii  python3-simplejson  3.17.0-1

python3-cherrypy3 suggests no packages.

-- no debconf information



More information about the Python-modules-team mailing list