ENCODING = sys.getfilesystemencoding()
if ENCODING.lower() in ('ascii', 'ansi_x3.4-1968'):
ENCODING = 'utf8'
- print('Using fallback encoding {} for temp file creation'
- .format(ENCODING))
- else:
- print('Using filesystem encoding {} for temp file creation'
+ print('\nWARNING: Using fallback encoding {} for temp file creation'
.format(ENCODING))
os.close(sys_file_descriptor)
with open(cls.import_file, 'wb') as file_handle:
file_handle.write(TEST_SET.encode(ENCODING))
- print('created temp file {0}'.format(cls.import_file))
except Exception:
- print('exception creating temp file:')
+ print('\nWARNING: exception creating temp file:')
print_exc()
# clean up
if cls.import_file is not None:
try:
os.unlink(cls.import_file)
- print('deleted temp file {0}'.format(cls.import_file))
except Exception:
- print('exception deleting temp file:')
+ print('\nWARNING: exception deleting temp file:')
print_exc()
# tests