mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #6957 from bernt-matthias/topic/empty-data-table
Topic/empty data table
This commit is contained in:
@@ -624,13 +624,13 @@ class TabularToolDataTable(ToolDataTable, Dictifiable):
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user