radiacode-tools
radiacode-tools copied to clipboard
os.rename() on temporary output file does not work across filesystems
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().