From c87e31aa599c581b050304f714c0101d02d4004b Mon Sep 17 00:00:00 2001 From: Ole Streicher Date: Tue, 4 Jun 2024 17:43:41 +0200 Subject: [PATCH] Set irafarch only if it could be determined --- pyraf/iraffunctions.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/pyraf/iraffunctions.py b/pyraf/iraffunctions.py index 228fbcb0..7c06d98c 100644 --- a/pyraf/iraffunctions.py +++ b/pyraf/iraffunctions.py @@ -152,8 +152,11 @@ def Init(doprint=1, hush=0, savefile=None): iraf = _os.environ['iraf'] if "IRAFARCH" not in _os.environ: - _os.environ["IRAFARCH"] = _getIrafArch(iraf) - arch = _os.environ["IRAFARCH"] + arch = _getIrafArch(iraf) + if arch is not None: + _os.environ["IRAFARCH"] = arch + else: + arch = _os.environ["IRAFARCH"] # stacksize problem on linux # https://iraf-community.github.io/iraf-v216/issues/61 @@ -309,14 +312,14 @@ def _getIrafArch(iraf): return m[1] # Retrieve it from the irafarch script - fname = _os.path.join(iraf, "unix", "hlib", "irafarch") - if _os.path.exists(fname): - import subprocess - exitcode, arch = subprocess.getstatusoutput(f"{fname} -actual") - if exitcode == 0: - return arch + #fname = _os.path.join(iraf, "unix", "hlib", "irafarch.sh") + #if _os.path.exists(fname): + # import subprocess + # exitcode, arch = subprocess.getstatusoutput(f"{fname} -actual") + # if exitcode == 0: + # return arch - return "" + return None # module variables that don't get saved (they get # initialized when this module is imported)