diff --git a/HISTORY.rst b/HISTORY.rst index 6ab110d5..f96d07c5 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,10 @@ ======= History ======= +2023.11.12 -- Allowing running flowchart.flow in current directory + * There was a feature which prevented running a flowchart named "flowchart.flow" in + the current directory when running from the commandline. + 2023.11.11 -- Incorporating changes to Zenodo * Zenodo updated and made small changes to their API, which required changes in SEAMM. diff --git a/seamm/run_flowchart.py b/seamm/run_flowchart.py index bf131afe..d12be9cd 100644 --- a/seamm/run_flowchart.py +++ b/seamm/run_flowchart.py @@ -295,11 +295,17 @@ def run( printer.job(datetime.now().strftime("%A %Y.%m.%d %H:%M:%S %Z")) printer.job("Running in directory '{}'".format(wdir)) - flowchart_path = os.path.join(wdir, "flowchart.flow") + flowchart_path = Path(wdir).resolve() / "flowchart.flow" + path = Path(sys.argv[0]).resolve() - # copy the flowchart to the root directory for later reference - if not in_jobserver: - shutil.copy2(sys.argv[0], flowchart_path) + # copy the flowchart to the root directory if it is not there already + if not in_jobserver and flowchart_path.exists() and path != flowchart_path: + shutil.copy2(path, flowchart_path) + + # Make executable if it isn't + permissions = flowchart_path.stat().st_mode + if permissions & 0o100 == 0: + flowchart_path.chmod(permissions | 0o110) logger.info(f" reading in flowchart '{flowchart_path}' -- 2") flowchart = seamm.Flowchart(directory=wdir) @@ -357,7 +363,7 @@ def run( with seamm_datastore.session_scope(db.Session) as session: job = db.Job.create( job_id, - flowchart_path, + str(flowchart_path), project_names=data["projects"], path=wdir, title=title,