Skip to content

os.rename() on temporary output file does not work across filesystems #2

@lvml

Description

@lvml

The code at:

os.rename(tfn, args.outfile)

fails if the current working directory is on a different filesystem than the output file:
OSError: [Errno 18] Invalid cross-device link: '/home/somedir/tmpu0m35l74' -> '/tmp/myoutputfile.n42'

A simple fix would be to use

   shutil.move(tfn, args.outfile)

instead of os.rename().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions