I want iterating on dict key as explained in the SilentGosht answer. But on some strings i get error. My environment is QGIS 2.14 python terminal
Here is my dict:
dictAliases = {
('ID_WS_INT','ID_WS'): 'B1',
('PGM_START','PGM_START_DATE','PGM_START_'): 'Debut programme'
}
Here my code to iterate on dict:
next(v for k, v in dictAliases.items() if 'PGM_START_' in k)
It works fine
BUT if put the dict in a separate file and import it as:
import sys
sys.path.append('C:\workspace\script')
import osirisdict
next(v for k, v in osirisdict.dictAliases.items() if 'ID_WS_int'in k)
I get:
Traceback (most recent call last): File "", line 1, in StopIteration
It's only on some strings as ID_WS_int in place of ID_WS_INT or PGM_START_ in place of PGM_START_DATE
I can't understand why the import changes things
here is the imported dict:
dictAliases = {
('ID_WS_INT','ID_WS'): 'B1',
('PGM_START','PGM_START_DATE','PGM_START_'): 'Debut programme',
('IMP_TYPE_F','IMP_TYPE_FR'): 'Type impetrant',
('PGM_START','PGM_START_DATE','PGM_START_'): 'Debut programme',
}