Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/buildcompiler/robotutils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import sbol2
import json
import os
import shutil
import subprocess
import tempfile
Expand Down Expand Up @@ -131,11 +130,15 @@ def run_opentrons_script_with_json_to_zip(

# Run inside temp dir so relative-path outputs land in tmpdir (and get zipped)

# Run script (which has opentrons script hardcoded) using JSON file
log = subprocess.run(["opentrons_simulate", opentrons_script_path, json_file_path], capture_output=True).stdout
# Run script (which has opentrons script hardcoded) using JSON file
log = subprocess.run(
["opentrons_simulate", str(tmp_script), str(tmp_json)],
capture_output=True,
cwd=tmpdir,
Comment on lines +133 to +137

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep simulator cwd where relative inputs exist

Running opentrons_simulate with cwd=tmpdir means the protocol executes in a directory that does not contain the files/ subfolder, but the protocol script still hardcodes open("files/assemblyplan_output.json", ...) and writes output into files (see files/run_sbol2assembly_libre.py:305–311). Because only assemblyplan_output.json is copied to the tmpdir root, this change causes a FileNotFoundError (or later failure when writing the XLSX) for the standard workflow where the script expects the repo’s files/ directory. Unless you also recreate files/ inside the tempdir or adjust the protocol to use the passed JSON path, the simulator will now fail before producing a zip.

Useful? React with 👍 / 👎.

).stdout

# Save log to a file in the temporary directory
with open(os.path.join(tmpdir, "build_log.txt"), "wb") as log_file:
with open(tmpdir / "build_log.txt", "wb") as log_file:
log_file.write(log)

# Always include logs in the zip
Expand Down