Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyerror: 'time' #1

Open
mrgenna opened this issue Jan 25, 2020 · 2 comments
Open

Keyerror: 'time' #1

mrgenna opened this issue Jan 25, 2020 · 2 comments

Comments

@mrgenna
Copy link

mrgenna commented Jan 25, 2020

Hello Daniel,
first..very nice job!
I'm facing with the following error after I started the web server:Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/flask/app.py", line 2309, in call
return self.wsgi_app(environ, start_response)
File "/usr/lib/python3/dist-packages/flask/app.py", line 2295, in wsgi_app
response = self.handle_exception(e)
File "/usr/lib/python3/dist-packages/flask/app.py", line 1741, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python3/dist-packages/flask/_compat.py", line 35, in reraise
raise value
File "/usr/lib/python3/dist-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python3/dist-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python3/dist-packages/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python3/dist-packages/flask/_compat.py", line 35, in reraise
raise value
File "/usr/lib/python3/dist-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python3/dist-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/pi/OPC-N3_python/AQ/rpiWebServer/interface.py", line 141, in start
data, sens = readrpi3data()
File "/home/pi/OPC-N3_python/AQ/rpiWebServer/interface.py", line 48, in readrpi3data
data["time"] = dateparse(data["time"])
File "/usr/local/lib/python3.7/dist-packages/pandas/core/frame.py", line 2995, in getitem
indexer = self.columns.get_loc(key)
File "/usr/local/lib/python3.7/dist-packages/pandas/core/indexes/base.py", line 2899, in get_loc
return self._engine.get_loc(self._maybe_cast_indexer(key))
File "pandas/_libs/index.pyx", line 107, in pandas._libs.index.IndexEngine.get_loc

File "pandas/_libs/index.pyx", line 131, in pandas._libs.index.IndexEngine.get_loc

File "pandas/_libs/hashtable_class_helper.pxi", line 1607, in pandas._libs.hashtable.PyObjectHashTable.get_item

File "pandas/_libs/hashtable_class_helper.pxi", line 1614, in pandas._libs.hashtable.PyObjectHashTable.get_item

KeyError: 'time'

Do you have any idea why is not working...I guess is locale setting...
Thanks Marco

@JarvisSan22
Copy link
Owner

Hi Marco
Sorry I have not tested the rpi3 interface with an OPCN3 as I no longer have access to an OPCN3
and the server code was designed for the my SDS011 directory and I just copied it other to the OPCN3 with some changes in the code, thinking it should work fine.

So I am thankful that you are trying to use, so we can actually get it working.
I have two ideas of what it could be.
1)Can you check your data files, that they have the "time" column if it's not spelt as "Time".
2)It could also be an issue with line 36 in interface.py
dataloop = pd.read_csv(file, header=4, error_bad_lines=False, engine='python',index_col=False)
The header may not be number 4, so its could be cutting data header column.

Kind regards
Daniel Jarvis

@mrgenna
Copy link
Author

mrgenna commented Jan 31, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants