Skip to content

Commit

Permalink
Merge pull request #6957 from bernt-matthias/topic/empty-data-table
Browse files Browse the repository at this point in the history
Topic/empty data table
  • Loading branch information
mvdbeek committed Nov 4, 2018
2 parents d6af6b7 + 13a4238 commit 0ede377
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/galaxy/tools/data/__init__.py
Expand Up @@ -624,13 +624,13 @@ def _add_entry(self, entry, allow_duplicates=True, persist=False, persist_on_err
except IOError as e:
log.warning('Error opening data table file (%s) with r+b, assuming file does not exist and will open as wb: %s', filename, e)
data_table_fh = open(filename, 'wb')
if os.stat(filename)[6] != 0:
if os.stat(filename).st_size != 0:
# ensure last existing line ends with new line
data_table_fh.seek(-1, 2) # last char in file
last_char = data_table_fh.read(1)
if last_char not in [b'\n', b'\r']:
data_table_fh.write(b'\n')
fields = "%s\n" % self.separator.join(fields)
fields = "%s\n" % self.separator.join(fields)
data_table_fh.write(fields.encode('utf-8'))
return not is_error

Expand Down

0 comments on commit 0ede377

Please sign in to comment.