mrgmarsh / wfrog

Automatically exported from code.google.com/p/wfrog
GNU General Public License v3.0
0 stars 0 forks source link

invalid literal for float() #102

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. View 365.html

What is the expected output? What do you see instead?
Outputs:

2011-12-18 14:30:54,093 ERROR [renderer.http] invalid literal for float(): 
2011-11-14 20:55:54
Traceback (most recent call last):
  File "/usr/lib/wfrog/wfrender/renderer/http.py", line 191, in do_GET
    [ mime, content ] = renderers[name].render(data=data, context=context)
  File "/usr/lib/wfrog/wfcommon/generic/include.py", line 79, in _call
    return self.target.__getattribute__(attr).__call__(*args, **keywords)
  File "/usr/lib/wfrog/wfrender/renderer/template.py", line 67, in render
    content = self.renderer.render(data=data, context=context)
  File "/usr/lib/wfrog/wfrender/renderer/data.py", line 44, in render
    new_data = self.source.execute(data=data, context=context)
  File "/usr/lib/wfrog/wfcommon/generic/service.py", line 59, in _call
    return services[self.name].__getattribute__(attr).__call__(*args, **keywords)
  File "/usr/lib/wfrog/wfcommon/generic/include.py", line 79, in _call
    return self.target.__getattribute__(attr).__call__(*args, **keywords)
  File "/usr/lib/wfrog/wfrender/datasource/accumulator.py", line 289, in execute
    last_timestamp, to_delete = self.update_slices(self.cached_slices, from_time, to_time, context, self.last_timestamp)
  File "/usr/lib/wfrog/wfrender/datasource/accumulator.py", line 226, in update_slices
    for sample in self.storage.samples(update_from_time, to_time, context=context):
  File "/usr/lib/wfrog/wfcommon/storage/csvfile.py", line 113, in samples
    sample[i] = float(sample[i])
ValueError: invalid literal for float(): 2011-11-14 20:55:54
2011-12-18 14:30:54,158 INFO [renderer.http] 79.195.157.27 - code 500, message 
Internal Server Error
2011-12-18 14:30:54,158 INFO [renderer.http] 79.195.157.27 - "GET /365days.html 
HTTP/1.1" 500 -

Just want to view year-history, got the message above instead :(

Can someone verify that?

Latest svn version used (18.12.2011)

Original issue reported on code.google.com by commi1...@gmail.com on 18 Dec 2011 at 1:34

GoogleCodeExporter commented 9 years ago
So, today I've checked, why the datetime comes.

I've searched for the datetime value in the csvfile:

=====================
1321299951,2011-11-14 20:45:51,-1.1,89.0,0.3,169.8,1.1,157,-2.7,0.0,0.0,1025.4,
1321300554,2011-11-14 
20:55:54,-1.0,90.0,0.1,157.0,1.0,157,-1321300554,2011-11-14 
20:55:54,,,,,,,,0.0,0.0,,
1321303662,2011-11-14 21:47:42,-0.8,93.0,0.0,90.0,0.0,,-1.8,0.0,0.0,1024.6,
=====================

One line isnt correct, but why?

The wflogger has damaged the csvfile on this line.

This is the one and only damaged line! Removing this has solved my issue, but 
why is wflogger write a date to the wind-row? (or is it rain row?).

I hope someone can check this.

Original comment by commi1...@gmail.com on 25 Dec 2011 at 12:51

GoogleCodeExporter commented 9 years ago
It looks like the one line was cut short and without a CR and then wfrog wrote 
another line with the same timestamp and no data. I don't have an explanation 
of why this happened. It would help to have logs from the same moment and see 
what type of error happened.

=====================
1321299951,2011-11-14 20:45:51,-1.1,89.0,0.3,169.8,1.1,157,-2.7,0.0,0.0,1025.4,
1321300554,2011-11-14 20:55:54,-1.0,90.0,0.1,157.0,1.0,157,-
1321300554,2011-11-14 20:55:54,,,,,,,,0.0,0.0,,
1321303662,2011-11-14 21:47:42,-0.8,93.0,0.0,90.0,0.0,,-1.8,0.0,0.0,1024.6,
=====================

Maybe the only thing we can do about it is make sure that 
wfcommon/storage/csvfile.py is able to ignore a badly written line (issuing a 
warning).

Original comment by jordi.pu...@gmail.com on 15 Jan 2012 at 12:04

GoogleCodeExporter commented 9 years ago
Hi Jordi - thanks for your answer ;)

I have no logs for this time, I've removed all logs a few weeks ago.

Your plan to ignore badly written lines and issue a warning sounds good.

Original comment by commi1...@gmail.com on 15 Jan 2012 at 12:10