@@ -122,18 +122,18 @@ def run(self):
122122 # PanDDA2
123123
124124 dataset_pdir = panddas_dir / "processed_datasets" / dtag
125- dataset_pdir .mkdir (parents = True , exist_ok = True )
126125 pandda2_log = dataset_pdir / "pandda2.log"
127-
128126 attachments .extend ([pandda2_log , ligand_cif ])
127+
129128 pandda2_command = f"source { PANDDA_2_DIR } /venv/bin/activate; \
130- python -u /dls_sw/i04-1/software/PanDDA2/scripts/process_dataset.py --data_dirs={ model_dir } --out_dir={ panddas_dir } --dtag={ dtag } --use_ligand_data=False --local_cpus=1 > { pandda2_log } "
129+ python -u /dls_sw/i04-1/software/PanDDA2/scripts/process_dataset.py --data_dirs={ model_dir } --out_dir={ panddas_dir } --dtag={ dtag } --use_ligand_data=False --local_cpus=1"
131130
132131 try :
133- subprocess .run (
132+ result = subprocess .run (
134133 pandda2_command ,
135134 shell = True ,
136- capture_output = True ,
135+ stdout = subprocess .PIPE ,
136+ stderr = subprocess .STDOUT ,
137137 text = True ,
138138 cwd = dataset_dir ,
139139 check = True ,
@@ -143,10 +143,14 @@ def run(self):
143143 except subprocess .CalledProcessError as e :
144144 self .log .error (f"PanDDA2 command: '{ pandda2_command } ' failed" )
145145 self .log .info (e .stdout )
146- self .log .error (e .stderr )
146+ with open (pandda2_log , "w" ) as log_file :
147+ log_file .write (e .stdout )
147148 self .send_attachments_to_ispyb (attachments , final_directory )
148149 return False
149150
151+ with open (pandda2_log , "w" ) as log_file :
152+ log_file .write (result .stdout )
153+
150154 # -------------------------------------------------------
151155 # PanDDA Rhofit ligand fitting
152156
0 commit comments