2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-26 01:01:53 +00:00

UTF-8 check inserted into databasereset

This commit is contained in:
Philip Sargent 2022-06-23 16:12:13 +03:00
parent 7b0d90182b
commit bd8d450542

View File

@ -4,6 +4,7 @@ import time
import timeit import timeit
import json import json
import resource import resource
import locale
import settings import settings
""" Command-line utility for loading cave data files into troggle's database. """ Command-line utility for loading cave data files into troggle's database.
@ -353,6 +354,16 @@ if __name__ == "__main__":
print("Do not run as root or using sudo - file permissions for cache files and logs will break") print("Do not run as root or using sudo - file permissions for cache files and logs will break")
print("Aborting run.") print("Aborting run.")
exit() exit()
if sys.getfilesystemencoding() != "utf-8":
print("UTF-8 is NOT the default file encoding. You must fix this.")
print(f'- {sys.getdefaultencoding()=}')
print(f'- {sys.getfilesystemencoding()=}')
print(f'- {locale.getdefaultlocale()=}')
print(f'- {locale.getpreferredencoding()=}')
print("Aborting run.")
exit()
if len(sys.argv)>2: if len(sys.argv)>2:
runlabel = sys.argv[len(sys.argv)-1] runlabel = sys.argv[len(sys.argv)-1]
else: else: