These are chat archives for cherrypy/cherrypy

13th
Apr 2018
Cody Scott
@Siecje
Apr 13 2018 13:00
I have updated CherryPy from 13.1.0 to 14.0.1 and now I am getting a traceback in syslog. https://dpaste.de/EucD
TypeError: staticfile() got multiple values for keyword argument 'filename'
Cody Scott
@Siecje
Apr 13 2018 13:07
It does not happen with version 14.0.0. Edit: nevermind I can't always reproduce it.
Cody Scott
@Siecje
Apr 13 2018 13:16
I saw it in production and was able to reproduce locally but now I can't reproduce locally.
Traceback (most recent call last):
  File "/home/siecje/.virtualenvs/edms/local/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 631, in respond
    self._do_respond(path_info)
  File "/home/siecje/.virtualenvs/edms/local/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 690, in _do_respond
    response.body = self.handler()
  File "/home/siecje/.virtualenvs/edms/local/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 221, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/home/siecje/.virtualenvs/edms/local/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 60, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/home/siecje/.virtualenvs/edms/local/lib/python2.7/site-packages/cherrypy/_cptools.py", line 181, in handle_func
    handled = self.callable(*args, **self._merged_args(kwargs))
TypeError: staticfile() got multiple values for keyword argument 'filename'
Cody Scott
@Siecje
Apr 13 2018 13:45
Okay the problem was that it was trying to serve a file that didn't exist.
Sviatoslav Sydorenko
@webknjaz
Apr 13 2018 14:28

@Siecje this happens when you pass same argument to the function twice, like:

func(arg1=1, arg2=2, arg1=3)

normally you would not do this manually, but when you use some dict var, which you unpack when calling the function and you don't verify its contents, this might happen:

# dynamic_params is some dict
func(arg1=1, **dynamic_params)  # you don't know what's in that dict if you don't do validation

and it might be:

dynamic_params = {'arg2': 2, 'arg1': 3}
Sviatoslav Sydorenko
@webknjaz
Apr 13 2018 15:25
@jaraco I can make uptime robot send you alerts if you want (via email/twitter)
Jason R. Coombs
@jaraco
Apr 13 2018 19:57
@webknjaz e-mail maybe. as long as they’re not noisy.
Sviatoslav Sydorenko
@webknjaz
Apr 13 2018 20:49
There may be some false alarms, but normally, not much + you can filter them in your mailbox. If you want, we could add email tag.