Private
Public Access
1
0

rdata fixes

This commit is contained in:
Sander Roosendaal
2021-04-12 19:10:15 +02:00
parent 53b5660c8f
commit bfd7a5b664
8 changed files with 199 additions and 45 deletions

View File

@@ -1110,7 +1110,7 @@ def rowhascoordinates(row):
f1 = row.csvfilename
u = row.user.user
r = getrower(u)
rowdata = rdata(f1)
rowdata = rdata(csvfile=f1)
hascoordinates = 1
if rowdata != 0:
try:
@@ -1129,9 +1129,11 @@ def rowhascoordinates(row):
# Wrapper around the rowingdata call to catch some exceptions
# Checks for CSV file, then for gzipped CSV file, and if all fails, returns 0
def rdata(file,rower=rrower()):
def rdata(csvfile=None,rower=rrower()):
if csvfile is None:
return 0
try:
res = rrdata(csvfile=file,rower=rower)
res = rrdata(csvfile=csvfile,rower=rower)
except pd.errors.EmptyDataError:
res = 0
except (IOError, IndexError, EOFError,FileNotFoundError):