Ticket #4504 (reopened defect)

Opened 1 year ago

Last modified 2 months ago

TypeError: a float is required

Reported by: mantas.kanaporis@gmail.com Assigned to: daan
Priority: highest Component: ScrumBurndownPlugin
Severity: blocker Keywords:
Cc: Trac Release: 0.11

Description

After pressing "Start milestone", I get a "TypeError?: a float is required" error message. For a full error trace see the attachment.

Attachments

TracBurndown problem.png (76.4 kB) - added by mantas.kanaporis@gmail.com on 01/23/09 19:36:03.
"TypeError?: a float is required" error trace

Change History

01/23/09 19:36:03 changed by mantas.kanaporis@gmail.com

  • attachment TracBurndown problem.png added.

"TypeError?: a float is required" error trace

01/24/09 06:42:46 changed by daan

  • owner changed from sambloomquist to daan.

01/24/09 06:48:34 changed by daan

Hi,

Can you try to rename your milestone so no 'special characters' are in the milestone name? If that works, I know what to fix :-)

- Daan

01/24/09 08:09:43 changed by mantas.kanaporis@gmail.com

Unfortunatelly, this didn't help. Tried to rename every milestone---same error.

01/27/09 06:47:26 changed by koma

same here :

Most recent call last:

  • File "/opt/csw/lib/python/site-packages/Trac-0.11.1-py2.5.egg/trac/web/main.py", line 423, in _dispatch_request Code fragment:
    1. try:
    2. if not env and env_error:
    3. raise HTTPInternalError(env_error)
    4. try:
    5. dispatcher = RequestDispatcher?(env)
    6. dispatcher.dispatch(req)
    7. except RequestDone?:
    8. pass
    9. resp = req._response or []
    10. except HTTPException, e:
  • Local variables: Name Value after [u' except RequestDone:', u' pass', u' resp = ... before [u' try:', u' if not env and env_error:', u' raise ... dispatcher <trac.web.main.RequestDispatcher? object at 0x8d6f84c> e TypeError?('a float is required',) env <trac.env.Environment object at 0x8827d6c> env_error None exc_info (<type 'exceptions.TypeError?'>, TypeError?('a float is required',), ... filename '/opt/csw/lib/python/site-packages/Trac-0.11.1-py2.5.egg/trac/web/main.py' frames [{'function': '_dispatch_request', 'lines_before': [u' try:', u' ... has_admin True line u' dispatcher.dispatch(req)' lineno 422 message u'TypeError?: a float is required' req <Request "GET u'/burndown'"> resp [] tb <traceback object at 0x92d9b6c> tb_hide None traceback 'Traceback (most recent call last):\n File ...
  • File "/opt/csw/lib/python/site-packages/Trac-0.11.1-py2.5.egg/trac/web/main.py", line 197, in dispatch Code fragment:
    1. req.args.get('FORM_TOKEN') != req.form_token:
    2. raise HTTPBadRequest('Missing or invalid form token. '
    3. 'Do you have cookies enabled?')
    4. # Process the request and render the template
    5. resp = chosen_handler.process_request(req)
    6. if resp:
    7. if len(resp) == 2: # Clearsilver
    8. chrome.populate_hdf(req)
    9. template, content_type = \
    10. self._post_process_request(req, *resp)
  • Local variables: Name Value chosen_handler <burndown.burndown.BurndownComponent? object at 0x8d6f52c> chrome <trac.web.chrome.Chrome object at 0x8cc626c> err (<type 'exceptions.TypeError?'>, TypeError?('a float is required',), ... handler <burndown.burndown.BurndownComponent? object at 0x8d6f52c> req <Request "GET u'/burndown'"> self <trac.web.main.RequestDispatcher? object at 0x8d6f84c>
  • File "build/bdist.linux-i686/egg/burndown/burndown.py", line 166, in process_request Local variables: Name Value components [{'owner': u'koen', 'name': u'hibernate domain model', 'description': ... data {'milestones': [{'started': None, 'completed': 0, 'description': ... db <trac.db.pool.PooledConnection? object at 0x90c082c> empty_db_for_testing 'false' milestones [{'started': None, 'completed': 0, 'description': u'refactor address ... req <Request "GET u'/burndown'"> selected_component u'All Components' selected_milestone {'started': None, 'completed': 0, 'description': u'\r\n * refactor ... self <burndown.burndown.BurndownComponent? object at 0x8d6f52c>
  • File "build/bdist.linux-i686/egg/burndown/burndown.py", line 233, in start_milestone Local variables: Name Value db <trac.db.pool.PooledConnection? object at 0x90c082c> milestone u'Locations functionality and domain model changes' self <burndown.burndown.BurndownComponent? object at 0x8d6f52c>
  • File "build/bdist.linux-i686/egg/burndown/dbhelper.py", line 96, in get_startdate_for_milestone Local variables: Name Value cursor <trac.db.util.IterableCursor? object at 0x90b6a64> db <trac.db.pool.PooledConnection? object at 0x90c082c> milestone u'Locations functionality and domain model changes' row (None,)

02/02/09 04:30:44 changed by jan0sch@gmx.net

I get the same error when I try to start a milestone. I did not get this error before switching to german date format (DD.MM.YYYY via PythonOption TracLocale de_DE.UTF8) but switching back did not resolve the problem (same error message).

Oops…
Trac detected an internal error: 

If you think this really should work and you can reproduce it, you should consider reporting this problem to the Trac team.

Go to http://trac.edgewall.org/ and create a new ticket where you describe the problem, how to reproduce it. Don't forget to include the Python traceback found below.

TracGuide — The Trac User and Administration Guide 
Python Traceback
Traceback (most recent call last):
  File "/var/lib/python-support/python2.5/trac/web/main.py", line 406, in dispatch_request
    dispatcher.dispatch(req)
  File "/var/lib/python-support/python2.5/trac/web/main.py", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "build/bdist.linux-i686/egg/burndown/burndown.py", line 166, in process_request
    self.start_milestone(db, selected_milestone['name'])
  File "build/bdist.linux-i686/egg/burndown/burndown.py", line 233, in start_milestone
    startdate = dbhelper.get_startdate_for_milestone(db, milestone)
  File "build/bdist.linux-i686/egg/burndown/dbhelper.py", line 96, in get_startdate_for_milestone
    return datetime.fromtimestamp(row[0])
TypeError: a float is required

02/24/09 10:26:28 changed by cj

I get the same problem, but only with newly created milestones. It works fine for milestones created before i installed the plugin.

02/24/09 15:37:38 changed by mantas.kanaporis@gmail.com

ok. seems that after going to "Adminstration" > "Scrum Burndown Plugin Settings" and manually setting the start of the milestone, the burndown starts collecting data. And in a few days time you can see the curve appearing.

04/17/09 07:05:51 changed by shu.shen@gmail.com

The same problem happens to my 0.10 trac installation. I found in the database the newly create milestone has null as "started" field. Problem is solved by manually setting this field as "0" by using sqlite.

I believe this is a bug that: 1) forgot to properly set the "started" when creating a new milestone, and 2) wrong handling code in get_startdate_for_milestone() of dhhelper.py

04/17/09 07:23:29 changed by anonymous

An easy fix is as below: Index: dbhelper.py =================================================================== --- dbhelper.py (revision 5529) +++ dbhelper.py (working copy) @@ -92,7 +92,7 @@

cursor.execute("SELECT started FROM milestone WHERE name = %s", [milestone]) row = cursor.fetchone()

- if(row and row[0]!=0): + if(row and row[0] and row[0]!=0):

return datetime.fromtimestamp(row[0])

else:

return None

(follow-up: ↓ 11 ) 04/17/09 07:25:54 changed by shu.shen@gmail.com

Repost patch with format

Index: dbhelper.py
===================================================================
--- dbhelper.py (revision 5529)
+++ dbhelper.py (working copy)
@@ -92,7 +92,7 @@
     cursor.execute("SELECT started FROM milestone WHERE name = %s", [milestone])
     row = cursor.fetchone()

-    if(row and row[0]!=0):
+    if(row and row[0] and row[0]!=0):
         return datetime.fromtimestamp(row[0])
     else:
         return None

(in reply to: ↑ 10 ; follow-up: ↓ 12 ) 05/22/09 06:42:31 changed by anonymous

Replying to shu.shen@gmail.com:

Repost patch with format {{{ #!python Index: dbhelper.py =================================================================== --- dbhelper.py (revision 5529) +++ dbhelper.py (working copy) @@ -92,7 +92,7 @@ cursor.execute("SELECT started FROM milestone WHERE name = %s", [milestone]) row = cursor.fetchone() - if(row and row[0]!=0): + if(row and row[0] and row[0]!=0): return datetime.fromtimestamp(row[0]) else: return None }}}

I can't find the file "dbhelper.py" I don't know how to modify it thanks

(in reply to: ↑ 11 ) 07/17/09 07:11:06 changed by anonymous

Replying to anonymous:

I can't find the file "dbhelper.py" I don't know how to modify it thanks

That's because the file's inside a (compressed) .egg file.

Here's what I did:

  • checkout scrumburndown from SVN: http://trac-hacks.org/svn/scrumburndownplugin/
  • fix the file scrumburndownplugin\burndown\dbhelper.py
  • create a new .egg file: python setup.py bdist_egg
  • delete the old egg file from tracprojectroot/plugins/
  • restart trac service / webserver
  • upload the new egg file using admin plugins page

08/25/09 14:45:22 changed by paul.jurco@gmail.com

hi,

i can't get it fixed...

i have the latest svn version (dbhelper.py fixed) and i get:

File "/usr/lib/python2.4/site-packages/Trac-0.11.5-py2.4.egg/trac/web/main.py", line 444, in _dispatch_request

dispatcher.dispatch(req)

File "/usr/lib/python2.4/site-packages/Trac-0.11.5-py2.4.egg/trac/web/main.py", line 205, in dispatch

resp = chosen_handler.process_request(req)

File "build/bdist.linux-i686/egg/burndown/burndown.py", line 166, in process_requestFile "build/bdist.linux-i686/egg/burndown/burndown.py", line 233, in start_milestoneFile "build/bdist.linux-i686/egg/burndown/dbhelper.py", line 96, in get_startdate_for_milestone

Other specs:
Trac: 0.11.5
Python: 2.4.3 (#1, Jan 21 2009, 01:10:13) [GCC 4.1.2 20071124 (Red Hat 4.1.2-42)]
setuptools: 0.6c7
SQLite: 3.6.16
pysqlite: 1.1.7
Genshi: 0.5.1
mod_python: 3.2.8
Pygments: 1.0
Subversion: 1.5.5 (r34862)
jQuery: 1.2.6

09/02/09 11:24:34 changed by agonzalez@qwi.es

I can confirm this bug exists on 1.9.1 and that the patch above works.

10/07/09 22:06:32 changed by daan

  • status changed from new to closed.
  • resolution set to fixed.

(In [6667]) Fixes #4504 (big thanks for the patch!) Created Python 2.6 egg This will be the last release to support Trac 0.10.5

11/25/09 13:58:14 changed by svdwal@mbrainsoftware.com

  • status changed from closed to reopened.
  • resolution deleted.

This problem still exists for trac 0.11.1 and TracBurndown? 1.9.2.

Trac is running on a Ubuntu 9.0.4 server, and amazingly the stack dump talks about macos 10.6. I downloaded the plugin using a mac OS snow leopard client to the server downloads folder. Maybe automatic os sniffing is not a good idea, unless there is a list of oS'es also available where I can pick the correct download by hand.

File "/usr/lib/python2.6/dist-packages/trac/web/main.py", line 423, in _dispatch_request

dispatcher.dispatch(req)

File "/usr/lib/python2.6/dist-packages/trac/web/main.py", line 197, in dispatch

resp = chosen_handler.process_request(req)

File "build/bdist.macosx-10.6-universal/egg/burndown/burndown.py", line 166, in process_requestFile "build/bdist.macosx-10.6-universal/egg/burndown/burndown.py", line 233, in start_milestoneFile "build/bdist.macosx-10.6-universal/egg/burndown/dbhelper.py", line 96, in get_startdate_for_milestone

System Information: User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)

Trac: 0.11.1 Python: 2.6.2 (release26-maint, Apr 19 2009, 02:11:59) [GCC 4.3.3] setuptools: 0.6c9 SQLite: 3.6.10 pysqlite: 2.5.0 Genshi: 0.5.1 mod_python: 3.3.1 Pygments: 0.10 Subversion: 1.5.4 (r33841) jQuery: 1.2.6

11/30/09 10:32:47 changed by anonymous

  • priority changed from normal to highest.

Bug still exists for me, too.

  • File "/usr/local/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/main.py", line 450, in _dispatch_request Code fragment:
    1. try:
    2. if not env and env_error:
    3. raise HTTPInternalError(env_error)
    4. try:
    5. dispatcher = RequestDispatcher?(env)
    6. dispatcher.dispatch(req)
    7. except RequestDone?:
    8. pass
    9. resp = req._response or []
    10. except HTTPException, e:
  • Local variables: Name Value after [u' except RequestDone:', u' pass', u' resp = ... before [u' try:', u' if not env and env_error:', u' raise ... dispatcher <trac.web.main.RequestDispatcher? object at 0x808dd94c> e TypeError?('a float is required',) env <trac.env.Environment object at 0x804f470c> env_error None exc_info (<type 'exceptions.TypeError?'>, TypeError?('a float is required',), ... filename '/usr/local/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/main ... frames [{'function': '_dispatch_request', 'lines_before': [u' try:', u' ... has_admin True line u' dispatcher.dispatch(req)' lineno 449 message u'TypeError?: a float is required' req <Request "GET u'/burndown'"> resp [] tb <traceback object at 0x80928d9c> tb_hide None traceback u'Traceback (most recent call last):\n File ...
  • File "/usr/local/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/main.py", line 206, in dispatch Code fragment:
    1. req.args.get('FORM_TOKEN') != req.form_token:
    2. raise HTTPBadRequest('Missing or invalid form token. '
    3. 'Do you have cookies enabled?')
    4. # Process the request and render the template
    5. resp = chosen_handler.process_request(req)
    6. if resp:
    7. if len(resp) == 2: # Clearsilver
    8. chrome.populate_hdf(req)
    9. template, content_type = \
    10. self._post_process_request(req, *resp)
  • Local variables: Name Value chosen_handler <burndown.burndown.BurndownComponent? object at 0x8080b28c> chrome <trac.web.chrome.Chrome object at 0x8080b42c> err (<type 'exceptions.TypeError?'>, TypeError?('a float is required',), ... handler <burndown.burndown.BurndownComponent? object at 0x8080b28c> req <Request "GET u'/burndown'"> self <trac.web.main.RequestDispatcher? object at 0x808dd94c>
  • File "build/bdist.linux-i686/egg/burndown/burndown.py", line 166, in process_request Local variables: Name Value components [{'owner': u'matthias', 'name': u'backend_fingertracking', 'description': ... data {'milestones': [{'started': 0, 'completed': 1233852010, 'description': ... db <trac.db.pool.PooledConnection? object at 0x80a1ed9c> empty_db_for_testing 'false' milestones [{'started': 0, 'completed': 1233852010, 'description': u, 'name': ... req <Request "GET u'/burndown'"> selected_component u'All Components' selected_milestone {'started': None, 'completed': 0, 'description': u'\r\nMinor-Release ... self <burndown.burndown.BurndownComponent? object at 0x8080b28c>
  • File "build/bdist.linux-i686/egg/burndown/burndown.py", line 233, in start_milestone Local variables: Name Value db <trac.db.pool.PooledConnection? object at 0x80a1ed9c> milestone u'2.3.0' self <burndown.burndown.BurndownComponent? object at 0x8080b28c>
  • File "build/bdist.linux-i686/egg/burndown/dbhelper.py", line 96, in get_startdate_for_milestone Local variables: Name Value cursor <trac.db.util.IterableCursor? object at 0x80a42dec> db <trac.db.pool.PooledConnection? object at 0x80a1ed9c> milestone u'2.3.0' row (None,)

File "/usr/local/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/main.py", line 450, in _dispatch_request

dispatcher.dispatch(req)

File "/usr/local/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/main.py", line 206, in dispatch

resp = chosen_handler.process_request(req)

File "build/bdist.linux-i686/egg/burndown/burndown.py", line 166, in process_requestFile "build/bdist.linux-i686/egg/burndown/burndown.py", line 233, in start_milestoneFile "build/bdist.linux-i686/egg/burndown/dbhelper.py", line 96, in get_startdate_for_milestone

Trac: 0.11.6 Python: 2.5.1 (r251:54863, Sep 22 2007, 01:43:31) [GCC 4.2.1 (SUSE Linux)] setuptools: 0.6c9 SQLite: 3.4.1 pysqlite: 2.3.2 Genshi: 0.5.1 mod_python: 3.3.1 RPC: 1.0.6 jQuery: 1.2.6

01/21/10 17:39:33 changed by anthony.groyer@parrot.com

In fact, the issue is not really fixed.

the current dbhelper.py source code has the code: if(row and row[0]!=0 and row[0]!=0): and should be if(row and row[0] and row[0]!=0):


Add/Change #4504 (TypeError: a float is required)




Change Properties
Action