L'esecuzione di tutti i test va in errore nel momento in cui apro i file utilizzando l'encoding 'utf-8-sig', mentre se utilizzo 'utf8' l'errore non si presenta, ma ovviamente l'encoding è sbagliato.
L'errore che ricevo è il seguente:
_______________________________________________________________________________________ Test.test_random_2592_00001_random_2592_rnd ________________________________________________________________________________________
self = <test_01.Test testMethod=test_random_2592_00001_random_2592_rnd>, filename = 'random-2592-rnd.txt', prosody = [0, 1, 0, 2, 3, 4, ...], module = 81, lengths = [27, 26, 27, 10, 10, 14, ...]
finals = ['vkvco', 'lfbqe', 'vkvco', 'ftfxe', 'hxlkoi', 'wcbueeio', ...]@file_data("random-2592-rnd.json")
def test_random_2592(self, filename, prosody, module, lengths, finals):
> return self.do_test(filename, prosody, module, lengths, finals)test_01.py:114:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_01.py:34: in do_test
result = program.ex1(poetry_file)
program01.py:67: in ex1
with open(poem_filename, encoding='UTF-8-SIG') as file:
testlib.py:66: in _check_open
return self.__orig_open(*args, **kargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _encoding = 'utf-8-sig'
def search_function(encoding):
# Cache lookup
entry = _cache.get(encoding, _unknown)
if entry is not _unknown:
return entry# Import the module:
#
# First try to find an alias for the normalized encoding
# name and lookup the module using the aliased name, then try to
# lookup the module using the standard import scheme, i.e. first
# try in the encodings package, then at top-level.
#
norm_encoding = normalize_encoding(encoding)
aliased_encoding = _aliases.get(norm_encoding) or \
_aliases.get(norm_encoding.replace('.', '_'))
if aliased_encoding is not None:
modnames = [aliased_encoding,
norm_encoding]
else:
modnames = [norm_encoding]
for modname in modnames:
if not modname or '.' in modname:
continue
try:
# Import is absolute to prevent the possibly malicious import of a
# module with side-effects that is not in the 'encodings' package.
> mod = __import__('encodings.' + modname, fromlist=_import_tail,
level=0)
E TypeError: _check_import() got an unexpected keyword argument 'fromlist'F:\Anaconda3\lib\encodings\__init__.py:98: TypeError