mdbtools not found with different language settings
prebm opened this issue · comments
Working on a Mac with german locale settings I was unable to convert styles because I got an error stating
The MDB tools "mdb-export" utility is required to convert .style databases. Please setup a path to the MDB tools utility in the Settings - Options dialog, under the SLYR tab.
although I could confirm they were installed in /opt/homebrew/bin
After some digging I found the line 146 in extractor.py using
if 'Usage' in line:
Now, on my Mac it seems mdb-export creates a localized manual when calling the process, making the check for 'Usage' useless. Changing it to 'Anwendungsoptionen' fixed the problem for me.
$ mdb-export
Wrong number of arguments.
Aufruf:
mdb-export [OPTION …] <file> <table> - export data from MDB file
Hilfeoptionen:
-h, --help Hilfeoptionen anzeigen
Anwendungsoptionen:
-H, --no-header Suppress header row.
-d, --delimiter=char Specify an alternative column delimiter. Default is comma.
-R, --row-delimiter=char Specify a row delimiter
-Q, --no-quote Don't wrap text-like fields in quotes.
-q, --quote=char Use <char> to wrap text-like fields. Default is double quote.
-X, --escape=format Use <char> to escape quoted characters within a field. Default is doubling.
-e, --escape-invisible Use C-style escaping for return (\r), tab (\t), line-feed (\n), and back-slash (\\) characters. Default is to leave as they are.
-I, --insert=backend INSERT statements (instead of CSV)
-N, --namespace=namespace Prefix identifiers with namespace
-S, --batch-size=int Size of insert batches on supported platforms.
-D, --date-format=format Set the date format (see strftime(3) for details)
-T, --datetime-format=format Set the date/time format (see strftime(3) for details)
-0, --null=char Use <char> to represent a NULL value
-b, --bin=strip|raw|octal|hex Binary export mode
-B, --boolean-words Use TRUE/FALSE in Boolean fields (default is 0/1)
--version Show mdbtools version and exit
If desired I could prepare a PR, but I am still unsure which conditional would be best to use. Especially as I cannot test it on other platforms. Do you have an idea what would be best to use in this case? Any string from the above is somewhat error-prone. Maybe 'export data from MDB file'. Any other ideas?
System: Apple M1, macOS Monterey, QGIS 3.16.14-Hannover
What if we change it to one of the strings which can never change? I.e. "row-delimiter". Does that work for you?
That works for me. I will prepare a PR.
Fixed by 1489c4a