CP 3.1.1 problem with Python 2.6

4 views
Skip to first unread message

Jon

unread,
Nov 12, 2008, 12:04:48 PM11/12/08
to cherryp...@googlegroups.com
(Just realized I incorrectly posted this to cp users yesterday rather than here...sorry for the crosspost).

Tried 3.1.1 on both my Vista and Win2K systems and ran into a TypeError (TB snipped at bottom of msg)

After changing _cpchecker.py's (line 42) monkey patch from...

def formatwarning(self, message, category, filename, lineno):

to match python's std lib warnings.py (line 36)...

def formatwarning(self, message, category, filename, lineno, line=None):


things work on v2.6 (and appear to work on 2.5 on XP) with my very simple test shown below.

I'm just starting to get serious evaluate CP so it's likely I've missed something. That said, I wonder if _cpchecker.py should be overriding warning.py's _show_warning hook on line 24?

My code problem or CP's?

Jon

SIMPLE CP TEST CODE
===================

import cherrypy

class Root(object):

@cherrypy.expose
def index(self):
return '''
<html>
<body>
<p>There is an <a href="showMessage">important message</a> waiting for you!</p>
</body>
</html>
'''

@cherrypy.expose
def showMessage(self):
return '''
<html>
<body>
<p>Hello CherryPy World!</p>
</body>
</html>
'''

def main():

# Global site config; can also be in a file
cherrypy.config.update({'server.socket_host' : '127.0.0.1',
'server.socket_port' : 8080,
'server.thread_pool' : 10,
'engine.autoreload.on' : True})

cherrypy.tree.mount(Root(), '/')

cherrypy.engine.start()
cherrypy.engine.block()

if __name__ == '__main__':
main()


TRACEBACK SNIPPET
=================
E:\Python26\lib\site-packages\cherrypy-3.1.1-py2.6.egg\cherrypy\lib\cptools.py:4: Deprecat
ionWarning: the md5 module is deprecated; use hashlib instead
import md5
E:\Python26\lib\site-packages\cherrypy-3.1.1-py2.6.egg\cherrypy\lib\sessions.py:16: Deprec
ationWarning: the sha module is deprecated; use the hashlib module instead
import sha
E:\Python26\lib\site-packages\cherrypy-3.1.1-py2.6.egg\cherrypy\_cperror.py:190: Deprecati
onWarning: BaseException.message has been deprecated as of Python 2.6
self.message = message
[11/Nov/2008:11:06:52] ENGINE Bus STARTING
[11/Nov/2008:11:06:52] ENGINE Error in 'start' listener <cherrypy._cpchecker.Checker objec
t at 0x00B89470>
Traceback (most recent call last):
File "e:\python26\lib\site-packages\CherryPy-3.1.1-py2.6.egg\cherrypy\process\wspbus.py"
, line 147, in publish
output.append(listener(*args, **kwargs))
File "e:\python26\lib\site-packages\CherryPy-3.1.1-py2.6.egg\cherrypy\_cpchecker.py", li
ne 38, in __call__
method()
File "e:\python26\lib\site-packages\CherryPy-3.1.1-py2.6.egg\cherrypy\_cpchecker.py", li
ne 61, in check_skipped_app_config
warnings.warn(msg)
File "E:\Python26\lib\warnings.py", line 29, in _show_warning
file.write(formatwarning(message, category, filename, lineno, line))
TypeError: formatwarning() takes exactly 5 arguments (6 given)

Otto.All...@googlemail.com

unread,
Dec 17, 2008, 3:37:02 PM12/17/08
to cherrypy-devel
Just came to confirm this behavior with the Linux version of Python
2.6.1 and to say that the proposed fix works as advertised. Thanks
Jon.



Otto

Robert Brewer

unread,
Jan 9, 2009, 12:30:14 PM1/9/09
to cherryp...@googlegroups.com
A long time ago, Jon wrote:
> Tried 3.1.1 on both my Vista and Win2K systems and ran into a
TypeError
> (TB snipped at bottom of msg)
>
> After changing _cpchecker.py's (line 42) monkey patch from...
>
> def formatwarning(self, message, category, filename, lineno):
>
> to match python's std lib warnings.py (line 36)...
>
> def formatwarning(self, message, category, filename, lineno,
> line=None):

Raised and fixed in http://www.cherrypy.org/ticket/891. Sorry for the
delay.


Robert Brewer
fuma...@aminus.org

Jon

unread,
Jan 12, 2009, 8:53:54 AM1/12/09
to cherryp...@googlegroups.com
>
> Raised and fixed in http://www.cherrypy.org/ticket/891. Sorry for the
> delay.
>
>
> Robert Brewer


thanks!

just removed my 'checker.on' : False config "fix" for the issue and things work great in a quick test on Python 2.6.1 using CP rev 2102

Reply all
Reply to author
Forward
0 new messages