Skip to content

Commit

Permalink
Removed harmful waiting for user input in csv.py and sql.py
Browse files Browse the repository at this point in the history
  • Loading branch information
philippkraft committed Feb 18, 2019
1 parent ea747f6 commit d6a4aeb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
16 changes: 4 additions & 12 deletions spotpy/database/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,10 @@ def save(self, objectivefunction, parameterlist, simulations=None, chains=1):
self.dim_dict['par'](parameterlist) +
self.dim_dict['simulation'](simulations) +
[chains])
try:
# Apply rounding of floats
coll = map(self.db_precision, coll)
self.db.write(
','.join(map(str, coll)) + '\n')
except IOError:
input("Please close the file " + self.dbname +
" When done press Enter to continue...")
# Apply rounding of floats
coll = map(self.db_precision, coll)
self.db.write(
','.join(map(str, coll)) + '\n')
# Apply rounding of floats
coll = map(self.db_precision, coll)
self.db.write(
','.join(map(str, coll)) + '\n')

acttime = time.time()
# Force writing to disc at least every two seconds
Expand Down
11 changes: 2 additions & 9 deletions spotpy/database/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,8 @@ def save(self, objectivefunction, parameterlist, simulations=None, chains=1):
[chains])
# Apply rounding of floats
coll = map(self.db_precision, coll)
try:
self.db_cursor.execute(
"INSERT INTO " + self.dbname + " VALUES (" + '"' + str('","'.join(map(str, coll))) + '"' + ")")

except Exception:
input("Please close the file " + self.dbname +
" When done press Enter to continue...")
self.db_cursor.execute(
"INSERT INTO " + self.dbname + " VALUES (" + '"' + str('","'.join(map(str, coll))) + '"' + ")")
self.db_cursor.execute(
"INSERT INTO " + self.dbname + " VALUES (" + '"' + str('","'.join(map(str, coll))) + '"' + ")")

self.db.commit()

Expand Down

0 comments on commit d6a4aeb

Please sign in to comment.