radiacode-tools icon indicating copy to clipboard operation
radiacode-tools copied to clipboard

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

Open lvml opened this issue 8 months ago • 0 comments

The code at: https://github.com/ckuethe/radiacode-tools/blob/3fee9e340f9ba5e852664f13fc66188b32c31381/src/radiacode_poll.py#L330 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().

lvml avatar Jun 23 '24 18:06 lvml