update error handle
This commit is contained in:
@@ -41,8 +41,11 @@ def generate_gmx_top_files(directory, num_cores, forcefield="amber99sb-ildn", wa
|
||||
|
||||
# Run the command and capture the standard error (stderr) to a log file
|
||||
log_file = parent.joinpath(f"{name}_topol.log")
|
||||
with open(log_file, "w") as log:
|
||||
subprocess.run(cmd, check=True, cwd=directory, stderr=log)
|
||||
try:
|
||||
with open(log_file, "w") as log:
|
||||
subprocess.run(cmd, check=True, cwd=directory, stderr=log)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Error processing {pdb_file.name}: {e}")
|
||||
|
||||
# Example usage
|
||||
directory = "pdb_top" # Replace with your actual directory path
|
||||
|
||||
Reference in New Issue
Block a user