Skip to content

Commit

Permalink
Some info regarding the possibility of BOM on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
harelba committed Jun 3, 2020
1 parent 192ec6d commit b9f59cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/q.py
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,7 @@ def _execute(self,query_str,input_params=None,stdin_file=None,stdin_filename='-'
msg = str(e)
error = QError(e,"query error: %s" % msg,1)
if "no such column" in msg and effective_input_params.skip_header:
warnings.append(QWarning(e,'Warning - There seems to be a "no such column" error, and -H (header line) exists. Please make sure that you are using the column names from the header line and not the default (cXX) column names'))
warnings.append(QWarning(e,'Warning - There seems to be a "no such column" error, and -H (header line) exists. Please make sure that you are using the column names from the header line and not the default (cXX) column names. Another issue might be that the file contains a BOM. Files that are encoded with UTF8 and contain a BOM can be read by specifying `-e utf-9-sig` in the command line. Support for non-UTF8 encoding will be provided in the future.'))
except ColumnCountMismatchException as e:
error = QError(e,e.msg,2)
except (UnicodeDecodeError, UnicodeError) as e:
Expand Down
4 changes: 2 additions & 2 deletions test/test-suite
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,8 @@ class BasicTests(AbstractQTestCase):
self.assertEqual(len(o), 0)
self.assertEqual(len(e), 2)
self.assertTrue(six.b('no such column: c3') in e[0])
self.assertEqual(
e[1], six.b('Warning - There seems to be a "no such column" error, and -H (header line) exists. Please make sure that you are using the column names from the header line and not the default (cXX) column names'))
self.assertTrue(
e[1].startswith(six.b('Warning - There seems to be a "no such column" error, and -H (header line) exists. Please make sure that you are using the column names from the header line and not the default (cXX) column names')))

self.cleanup(tmpfile)

Expand Down

0 comments on commit b9f59cb

Please sign in to comment.