audeering / audeer

Helpful Python functions
https://audeering.github.io/audeer/
Other
3 stars 0 forks source link

audeer.move() works only for files on the same file system #144

Closed frankenjoe closed 8 months ago

frankenjoe commented 8 months ago

I run into OSError: [Errno 18] Invalid cross-device link when I used audeer.move() to move a file to another file system. Under the hood we call os.rename(), which indeed does not support moving between file systems:

image

So I guess we should either document it or - if possible - use shutil.move() when files are not on the same file system.

frankenjoe commented 8 months ago

I guess the easiest workaround is to capture OSError and check if error message contains 'Invalid cross-device link'. If this is the case we fallback to shutil.move().

hagenw commented 8 months ago

This is a duplicate of https://github.com/audeering/audeer/issues/71, where you actually proposed more or less the same solution to solve the issue. So maybe it's time we tackle this ;)

frankenjoe commented 8 months ago

Duplicate of #71