diff --git a/aiida_fleur/cmdline/util/__init__.py b/aiida_fleur/cmdline/util/__init__.py index dce99968..75623123 100755 --- a/aiida_fleur/cmdline/util/__init__.py +++ b/aiida_fleur/cmdline/util/__init__.py @@ -30,6 +30,8 @@ def cmd_defaults(): dict["fleur"]=get_code_interactive("fleur.fleur",dict["fleur"]) dict["inpgen"]=get_code_interactive("fleur.inpgen",dict["inpgen"]) + import os + HOME=os.getenv("HOME") try: os.mkdir(f"{HOME}/.aiida-fleur") except: diff --git a/aiida_fleur/cmdline/util/defaults.py b/aiida_fleur/cmdline/util/defaults.py index fac0a230..6cf7e195 100644 --- a/aiida_fleur/cmdline/util/defaults.py +++ b/aiida_fleur/cmdline/util/defaults.py @@ -99,18 +99,17 @@ def get_fept_film_structure(): # Codes def get_inpgen(): """Return a `Code` node of the latest added inpgen executable in the database.""" - try: - return get_default_dict()["inpgen"] - except: - return get_last_code('fleur.inpgen') - + inpgen=get_default_dict()["inpgen"] + if inpgen==None: + inpgen=get_last_code("fleur.inpgen") + return inpgen def get_fleur(): """Return a `Code` node of the latest added inpgen executable in the database.""" - try: - return get_default_dict()["fleur"] - except: - return get_last_code('fleur.fleur') + fleur=fleur=get_default_dict()["fleur"] + if fleur==None: + fleur=get_last_code('fleur.fleur') + return fleur