Skip to content

Commit

Permalink
fix: fixed working directories of temporary files
Browse files Browse the repository at this point in the history
  • Loading branch information
jonrkarr committed Jan 3, 2022
1 parent e0efe47 commit bb64fc5
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion biosimulators_utils/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.154'
__version__ = '0.1.155'
2 changes: 1 addition & 1 deletion biosimulators_utils/model_lang/smoldyn/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def validate_model(filename, name=None, config=None):
if os.path.isfile(filename):
config = read_smoldyn_simulation_configuration(filename)
disable_smoldyn_graphics_in_simulation_configuration(config)
fid, config_filename = tempfile.mkstemp(suffix='.txt')
fid, config_filename = tempfile.mkstemp(suffix='.txt', dir=os.path.dirname(filename))
os.close(fid)
write_smoldyn_simulation_configuration(config, config_filename)
with StandardOutputErrorCapturer(level=StandardOutputErrorCapturerLevel.c, relay=False) as captured:
Expand Down
2 changes: 1 addition & 1 deletion biosimulators_utils/omex_meta/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def read_rdf(cls, filename, config=None):

lines[0] = line

temp_fid, temp_filename = tempfile.mkstemp()
temp_fid, temp_filename = tempfile.mkstemp(dir=os.path.dirname(filename))
os.close(temp_fid)
with open(temp_filename, 'wb') as file:
for line in lines:
Expand Down
2 changes: 1 addition & 1 deletion biosimulators_utils/sedml/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ def exec_task(task, variables, preprocessed_task=None, log=None, config=None, **
model = sub_task.task.model
if apply_xml_model_changes and is_model_language_encoded_in_xml(model.language):
original_model_source = model.source
fid, model.source = tempfile.mkstemp(suffix='.xml')
fid, model.source = tempfile.mkstemp(suffix='.xml', dir=os.path.dirname(original_model_source))
os.close(fid)

model_etrees[model.id].write(model.source,
Expand Down
2 changes: 1 addition & 1 deletion biosimulators_utils/sedml/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def resolve_model_and_apply_xml_changes(model, sed_doc, working_dir,
# write model to file
if save_to_file:
if temp_model_source is None:
modified_model_file, temp_model_source = tempfile.mkstemp(suffix='.xml')
modified_model_file, temp_model_source = tempfile.mkstemp(suffix='.xml', dir=os.path.dirname(model.source))
os.close(modified_model_file)
model.source = temp_model_source

Expand Down

0 comments on commit bb64fc5

Please sign in to comment.