diff --git a/course_link.py b/course_link.py index 3c14fba6dd071788ea6eadcfde4c494c92775669..7c2273a6a929b87aaad1c132fa8959e9f33e560a 100644 --- a/course_link.py +++ b/course_link.py @@ -7,23 +7,26 @@ Created on 24/08/2018 """ import os -import sys - +import sys + # Absolute path to the config file if len(sys.argv) == 3: - CONFIG_FILE_NAME = sys.argv[1] + 'src/config.yml' + CONFIG_FILE_NAME = sys.argv[1] + 'src/config.yml' name = sys.argv[2] else: - CONFIG_FILE_NAME = 'src/config.yml' + CONFIG_FILE_NAME = 'src/config.yml' name = sys.argv[1] - + with open(CONFIG_FILE_NAME, 'r') as stream: try: import yaml document = yaml.load(stream) stream.close() titre = document['name'][name] - except KeyError: + except: titre = name -print(titre.encode('utf-8')) \ No newline at end of file +if sys.version_info.major >= 3: + print(titre) +else: + print(titre.encode('utf-8'))