-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
The first time I run below code (tmpo.sqlit3 does not exist yet), it works.
But when I run it a second time (thus when tmpo.sqlite3 already exists), it fails with the following error:
In[2]: from opengrid_dev.library import houseprint
...: hp = houseprint.Houseprint()
...: hp.sync_tmpos()
Backend TkAgg is interactive backend. Turning interactive mode on.
Opening connection to Houseprint sheet
Opening spreadsheets
Parsing spreadsheets
35 Sites created
36 Devices created
102 sensors created
Houseprint parsing complete
0%| | 0/102 [00:00<?, ?it/s]Using tmpo database from C:\Users\kdb\tmpo\tmpo.sqlite3
1%| | 1/102 [00:00<00:16, 6.22it/s]
Traceback (most recent call last):
File "C:\GitLab\opengrid_dev\venv\lib\site-packages\IPython\core\interactiveshell.py", line 2910, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-e58e45ca9dc8>", line 4, in <module>
hp.sync_tmpos()
File "C:\GitLab\opengrid_dev\opengrid_dev\library\houseprint\houseprint.py", line 489, in sync_tmpos
tmpos.sync(sensor.key)
File "C:\GitLab\opengrid_dev\venv\lib\site-packages\tmpo\__init__.py", line 165, in wrapper
raise e
File "C:\GitLab\opengrid_dev\venv\lib\site-packages\tmpo\__init__.py", line 157, in wrapper
result = func(*args, **kwargs)
File "C:\GitLab\opengrid_dev\venv\lib\site-packages\tmpo\__init__.py", line 277, in sync
self._req_sync(sid, rid, lvl, bid)
File "C:\GitLab\opengrid_dev\venv\lib\site-packages\tmpo\__init__.py", line 553, in _req_sync
f.result(), sid, t["rid"], t["lvl"], t["bid"], t["ext"])
File "C:\GitLab\opengrid_dev\venv\lib\site-packages\tmpo\__init__.py", line 569, in _write_block
self.dbcur.execute(SQL_TMPO_INS, (sid, rid, lvl, bid, ext, now, blk))
sqlite3.IntegrityError: UNIQUE constraint failed: tmpo.sid, tmpo.rid, tmpo.lvl, tmpo.bid```Metadata
Metadata
Assignees
Labels
No labels