diff --git a/mail/generate.py b/mail/generate.py index 7009275..84c1dd9 100755 --- a/mail/generate.py +++ b/mail/generate.py @@ -10,7 +10,13 @@ def runcmd(cmd): return proc.communicate() local_path = Path(__file__).resolve().parent -node_bin = Path(runcmd("npm bin")[0].decode('utf-8').rstrip()) +out = runcmd("npm bin") + +try: + node_bin = Path(out[0].decode('utf-8').rstrip()) +except: + node_bin = Path(out.decode('utf-8').rstrip()) + print(f"assuming npm bin directory \"{node_bin}\". Is this correct?") if input("[yY/nN]: ").lower() == "n": node_bin = local_path.parent / 'node_modules' / '.bin'