Skip to content

Configuration error with Python 3.5 keywordargs #1382

Description

Originally reported by: Florijan Hamzic (Bitbucket: florijanh, GitHub: Unknown)


I am using VirtualHost dispatcher in config file but with python 3.5 this doesn't work:

[/]
request.dispatch = cherrypy.dispatch.VirtualHost(
**{
'bay.de:9111': '/Web',
})

#!python

[03/Oct/2015:16:28:06] ENGINE Waiting for child threads to terminate...
[03/Oct/2015:16:28:06] ENGINE Re-spawning /home/cin/dev/b01/starter.py
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/cherrypy/lib/reprconf.py", line 218, in as_dict
    value = unrepr(value)
  File "/usr/lib/python3.5/site-packages/cherrypy/lib/reprconf.py", line 477, in unrepr
    return b.build(obj)
  File "/usr/lib/python3.5/site-packages/cherrypy/lib/reprconf.py", line 360, in build
    return m(o)
  File "/usr/lib/python3.5/site-packages/cherrypy/lib/reprconf.py", line 388, in build_Call
    if o.starargs is None:
AttributeError: 'Call' object has no attribute 'starargs'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/cin/dev/b01/starter.py", line 16, in <module>
    mainApp = cherrypy.tree.mount(Main(), "/", config="global.conf")
  File "/usr/lib/python3.5/site-packages/cherrypy/_cptree.py", line 224, in mount
    app.merge(config)
  File "/usr/lib/python3.5/site-packages/cherrypy/_cptree.py", line 98, in merge
    _cpconfig.merge(self.config, config)
  File "/usr/lib/python3.5/site-packages/cherrypy/_cpconfig.py", line 139, in merge
    for section, value_map in reprconf.as_dict(other).items():
  File "/usr/lib/python3.5/site-packages/cherrypy/lib/reprconf.py", line 51, in as_dict
    config = Parser().dict_from_file(config)
  File "/usr/lib/python3.5/site-packages/cherrypy/lib/reprconf.py", line 233, in dict_from_file
    return self.as_dict()
  File "/usr/lib/python3.5/site-packages/cherrypy/lib/reprconf.py", line 224, in as_dict
    raise ValueError(msg, x.__class__.__name__, x.args)
ValueError: ('Config error in section: \'/\', option: \'request.dispatch\', value: "cherrypy.dispatch.VirtualHost(\\n**{\\n\'bay.de:9111\': \'/Web\',\\n})". Config values must be valid Python.', 'AttributeError', ("'Call' object has no attribute 'starargs'",))

To work around it is possible to set the dispatch right in the python code.


Activity

  1. ghost added on Apr 30, 2016
  2. ghost closed this as completedon Apr 30, 2016
  3. added 2 commits that reference this issue on Apr 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions