JarvisSan22 / OPC-N3_python

Python repository for OPCN3 and OPCN2 on RPI3
GNU General Public License v3.0
12 stars 8 forks source link

Keyerror: 'time' #1

Open mrgenna opened 4 years ago

mrgenna commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

Hi Daniel, thanks for your hints, I’m away for some days, as soon as I can reach the Rpi I try to che the code again and I’ll let you! Thanks a lot Marco

On 27 Jan 2020, at 11:27, Daniel Jarvis notifications@github.com wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.