Skip to content

Wrong temporaty file handling in SwarmRequest.eval_model_for_cdf_file() #138

@pacesm

Description

@pacesm

There is a bug in the SwarmRequest.eval_model_for_cdf_file() method preventing operations if the output file is supposed to be saved in a different file-system than the one of the current working directory:

A call like

request = SwarmRequest()
request.eval_model_for_cdf_file(
    ...
    output_cdf_filename="/tmp/test.cdf",
  )

leads to en error like

Traceback (most recent call last):
  File ".../model_test.py", line XYZ, in <module>
    request.eval_model_for_cdf_file(
  File ".../viresclient/_client_swarm.py", line 2915, in eval_model_for_cdf_file
    os.rename(temp_cdf_filename, output_cdf_filename)
OSError: [Errno 18] Invalid cross-device link: '.{output_cdf_filename}.tmp.cdf' -> '/tmp/test.cdf''

This is caused by the wrong naming of the output temporary file

temp_cdf_filename = ".{output_cdf_filename}.tmp.cdf"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions