diff --git a/lib/galaxy/tools/data/__init__.py b/lib/galaxy/tools/data/__init__.py index 6c05b60ccb1..e4a13d0e207 100644 --- a/lib/galaxy/tools/data/__init__.py +++ b/lib/galaxy/tools/data/__init__.py @@ -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