1
1
mirror of https://github.com/harelba/q.git synced 2024-11-20 11:19:04 +03:00

Some info regarding the possibility of BOM on failure

This commit is contained in:
Harel Ben-Attia 2020-06-03 16:52:12 +03:00
parent 192ec6db4a
commit b9f59cbfc2
2 changed files with 3 additions and 3 deletions

View File

@ -1424,7 +1424,7 @@ class QTextAsData(object):
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:

View File

@ -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)