question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: TypeError: staticfile() got multiple values for keyword argument 'filename'

See original GitHub issue
  • I’m submitting a … bug report

  • What is the current behavior?

[17/Aug/2017:18:17:13] HTTP 
Request Headers:
  REFERER: https://147.2.212.144:8001/plugins/kimchi/novnc/vnc_auto.html?port=8001&path=/websockify?token=Vk5D&encrypt=1
  HOST: 147.2.212.144
  CONNECTION: close
  Remote-Addr: 127.0.0.1
  X-REAL-IP: 147.2.212.73
  ACCEPT: image/webp,image/apng,image/*,*/*;q=0.8
  USER-AGENT: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36
  COOKIE: wokLang=en_US; username=river; user_role=admin; lastPage="/#plugins/kimchi/tabs/guests"; wok=cf2a807d2d726db5ce3b86822dea991cebdb3234; token=Vk5D
  ACCEPT-LANGUAGE: zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4,zh-TW;q=0.2
  X-FORWARDED-FOR: 147.2.212.73
  DNT: 1
  ACCEPT-ENCODING: gzip, deflate, br
INFO:cherrypy.error.140087717154000:[17/Aug/2017:18:17:13] HTTP 
Request Headers:
  REFERER: https://147.2.212.144:8001/plugins/kimchi/novnc/vnc_auto.html?port=8001&path=/websockify?token=Vk5D&encrypt=1
  HOST: 147.2.212.144
  CONNECTION: close
  Remote-Addr: 127.0.0.1
  X-REAL-IP: 147.2.212.73
  ACCEPT: image/webp,image/apng,image/*,*/*;q=0.8
  USER-AGENT: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36
  COOKIE: wokLang=en_US; username=river; user_role=admin; lastPage="/#plugins/kimchi/tabs/guests"; wok=cf2a807d2d726db5ce3b86822dea991cebdb3234; token=Vk5D
  ACCEPT-LANGUAGE: zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4,zh-TW;q=0.2
  X-FORWARDED-FOR: 147.2.212.73
  DNT: 1
  ACCEPT-ENCODING: gzip, deflate, br
[17/Aug/2017:18:17:13] HTTP 
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/CherryPy-11.0.1.dev70+g1b979c3e-py2.7.egg/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/usr/lib/python2.7/site-packages/CherryPy-11.0.1.dev70+g1b979c3e-py2.7.egg/cherrypy/lib/encoding.py", line 221, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/CherryPy-11.0.1.dev70+g1b979c3e-py2.7.egg/cherrypy/_cpdispatch.py", line 60, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/usr/lib/python2.7/site-packages/CherryPy-11.0.1.dev70+g1b979c3e-py2.7.egg/cherrypy/_cptools.py", line 185, in handle_func
    handled = self.callable(*args, **self._merged_args(kwargs))
TypeError: staticfile() got multiple values for keyword argument 'filename'
ERROR:cherrypy.error.140087717154000:[17/Aug/2017:18:17:13] HTTP 
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/CherryPy-11.0.1.dev70+g1b979c3e-py2.7.egg/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/usr/lib/python2.7/site-packages/CherryPy-11.0.1.dev70+g1b979c3e-py2.7.egg/cherrypy/lib/encoding.py", line 221, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/CherryPy-11.0.1.dev70+g1b979c3e-py2.7.egg/cherrypy/_cpdispatch.py", line 60, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/usr/lib/python2.7/site-packages/CherryPy-11.0.1.dev70+g1b979c3e-py2.7.egg/cherrypy/_cptools.py", line 185, in handle_func
    handled = self.callable(*args, **self._merged_args(kwargs))
TypeError: staticfile() got multiple values for keyword argument 'filename'
  • If the current behavior is a bug, please provide the steps to reproduce and if possible a screenshots and logs of the problem.

I debug it, modify the code:

# /usr/lib/python2.7/site-packages/CherryPy-11.0.1.dev70+g1b979c3e-py2.7.egg/cherrypy/_cptools.py
        @expose
        def handle_func(*a, **kw):
            print("args: ", args)
            print("self._merged_args(kwargs): ", self._merged_args(kwargs))
            handled = self.callable(*args, **self._merged_args(kwargs))
            if not handled:
                raise cherrypy.NotFound()
            return cherrypy.serving.response.body
        return handle_func

print it:

('args: ', ('/usr/lib/python2.7/site-packages/CherryPy-11.0.1.dev70+g1b979c3e-py2.7.egg/cherrypy/favicon.ico',))
('self._merged_args(kwargs): ', {'filename': '/usr/share/wok/ui/images/logo.ico'})

and found the staticfile:

def staticfile(filename, root=None, match='', content_types=None, debug=False):

Here: Because of args is not None and self._merged_args(kwargs) has the key filename, the repeat incoming parameter filename results in the broken.

  • What is the expected behavior? 😃

  • What is the motivation / use case for changing the behavior? I could solve adding these code:

--- cherrypy/_cptools.py	2017-08-17 12:38:22.738399515 +0800
+++ /usr/lib/python2.7/site-packages/CherryPy-11.0.1.dev70+g1b979c3e-py2.7.egg/cherrypy/_cptools.py	2017-08-17 18:27:16.799323121 +0800
@@ -179,7 +179,12 @@
         """
         @expose
         def handle_func(*a, **kw):
-            handled = self.callable(*args, **self._merged_args(kwargs))
+            parameters = ('filename', 'root', 'match', 'content_types', 'debug')
+            kws = self._merged_args(kwargs)
+            for i in range(len(args)):
+                kws.pop(parameters[i], None) 
+            handled = self.callable(*args, **kws)
             if not handled:
                 raise cherrypy.NotFound()
             return cherrypy.serving.response.body

But I don’t know what these would result to, and I don’t know cherrypy’s principle… Let you help me.

  • Please tell us about your environment:
  • Python version: 2.7.13
  • OS: openSUSE Tumbleweed
  • Kimchi: 2.5.0
  • Wok: 2.5.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sanjaySPcommented, Aug 13, 2018

I had the same issue.

i resolved it by removing the fav icon path in the config and used the static path /favicon.ico': { 'tools.staticfile.on': True, 'tools.staticfile.filename': '/static/ico/favicon.ico' } i added this in the html file. <link rel="shortcut icon" href="/static/img/user-avatar.png"> in the html file

This is caused due to the override of the ** default icon** of Cherrypy. We have already exposed the static directory. so we can directly use it to override in the _ html file_.

0reactions
webknjazcommented, Aug 19, 2017

Currently this looks like a bug within software you are using, so I’m closing this issue. But if you’d come up with the evidence of bug in CherryPy, feel free to post it here and reopen this case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: got multiple values for argument - Stack Overflow
This happens when a keyword argument is specified that overwrites a positional argument. For example, let's imagine a function that draws a ...
Read more >
'Got multiple values for argument' error with keyword ...
'Got multiple values for argument' error with keyword arguments ... TypeError: test_noself() takes 2 positional arguments but 3 were given.
Read more >
Changes — Flask Documentation (2.2.x)
Rewrite some error messages to be more consistent. ... The filename parameter has been renamed to path , the old name is deprecated....
Read more >
login() got an unexpected keyword argument 'template_name'
TypeError at /users/login/ login() got an unexpected keyword argument ... Exception Value: ... '2|878cf834|c449d16f85d12cdef7046b0ac6567a54|1534532218'.
Read more >
Tutorial — Bottle 0.13-dev documentation
Let's add some more (don't forget from bottle import template ): ... Each wildcard passes the covered part of the URL as a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found