From eea26bf0373673662c676d957472bc7d7df86109 Mon Sep 17 00:00:00 2001 From: Roland van Laar Date: Mon, 31 May 2021 15:55:52 +0200 Subject: [PATCH] Specify correct codec in `no such column` warning Running `q` with `-e utf-9-sig` results in: Encoding utf-9-sig could not be found The `-e` flag is necessary when a CSV file starts with a byte order mark (BOM). Update the warning message to specify that `-e utf-8-sig` is the correct usage. --- bin/q.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/q.py b/bin/q.py index 59ecc882..663bd7e5 100755 --- a/bin/q.py +++ b/bin/q.py @@ -1577,7 +1577,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. 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.')) + 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-8-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: