mirror of
https://github.com/FAUSheppy/ths-datenlogger
synced 2025-12-06 04:11:34 +01:00
do not abort on value error in dbf (warning only)
This commit is contained in:
@@ -211,7 +211,7 @@ def read_in_file(path, backend=None, outsideData=False, plotOutsideTemp=True,
|
||||
elif backend != None:
|
||||
backend(path)
|
||||
elif path.endswith(".DBF") or path.endswith(".dbf"):
|
||||
dbfread(path,datapoints,pt,ph,pd)
|
||||
dbfread(path,datapoints,pt,ph,pd, qtTextBrowser)
|
||||
elif path.endswith(".xls") or path.endswith(".XLS"):
|
||||
csvread(path,datapoints,pt,ph,pd,qtTextBrowser)
|
||||
elif path.endswith(".txt"):
|
||||
@@ -233,8 +233,20 @@ def read_in_file(path, backend=None, outsideData=False, plotOutsideTemp=True,
|
||||
|
||||
return datapoints
|
||||
|
||||
def dbfread(path,datapoints,pt,ph,pd):
|
||||
for record in DBF(path):
|
||||
def dbfread(path, datapoints, pt, ph, pd, qtTextBrowser):
|
||||
print("lol")
|
||||
dbfIterator = iter(DBF(path))
|
||||
print("lol2")
|
||||
while True:
|
||||
record = None
|
||||
try:
|
||||
record = next(dbfIterator)
|
||||
except ValueError as e:
|
||||
qtTextBrowser.append("Warning: Fehlerhafter Eintrag wird übersprungen")
|
||||
continue
|
||||
except StopIteration:
|
||||
break
|
||||
|
||||
parse_line(datapoints, record, 'DATETIME',
|
||||
[ ('TEMPCELS',pt), ('HUMIDITY',ph), ('DEWCELS',pd) ],
|
||||
timeutils.time_from_dbf)
|
||||
|
||||
@@ -16,6 +16,7 @@ import datetime as dt
|
||||
|
||||
import input_backend
|
||||
import plot
|
||||
import traceback
|
||||
import config_parse as cp
|
||||
|
||||
class WidgetGallery(QDialog):
|
||||
@@ -242,9 +243,10 @@ class WidgetGallery(QDialog):
|
||||
qtTextBrowser=self.infoTextBox)
|
||||
except Exception as e:
|
||||
errorBox = QMessageBox(self)
|
||||
errorBox.setStyleSheet("QLabel{min-width: 700px;}");
|
||||
errorBox.setAttribute(PyQt5.QtCore.Qt.WA_DeleteOnClose)
|
||||
errorBox.setText(self.localization.error_read_in)
|
||||
errorBox.setDetailedText(str(e))
|
||||
errorBox.setDetailedText(traceback.format_exc())
|
||||
errorBox.show()
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user