Bug in profiler.py

4 views
Skip to first unread message

Faber

unread,
Nov 8, 2005, 9:01:29 PM11/8/05
to cherrypy-users
I'm using CherryPy 2.1, and if I try to use the profiling script as in
2nd point of http://www.cherrypy.org/wiki/Profiler21 I get this error:

Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.4/threading.py", line 442, in __bootstrap
self.run()
File "/usr/lib/python2.4/threading.py", line 422, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/lib/python2.4/site-packages/cherrypy/_cpserver.py", line
171, in _start_http
self.httpserver.start()
File "/usr/lib/python2.4/site-packages/cherrypy/_cpwsgiserver.py",
line 308, in start
self.socket.bind(self.bind_addr)
File "<string>", line 1, in bind
TypeError: an integer is required

I think that the error is at line 142 of profiler.py, that should be
changed from

cherrypy.config.update({'server.socketPort': port,

to

cherrypy.config.update({'server.socketPort': int(port),

Because if I call

python profiler.py /var/www/myapp/profile 8000

the "8000" is a string in the sys.argv list, not an integer (required
by socket.bind, I presume).

Regards

Reply all
Reply to author
Forward
0 new messages