Cannot write MD to files located on different drive
ColinTalbert opened this issue · 2 comments
When I try to write MD to files stored on a drive different from the one used by NamedTemporaryFile, I get a OSError: [WinError 17] The system cannot move the file to a different disk drive:
Could https://github.com/riggsd/guano-py/blob/master/guano.py#L489 be changed to use shutil.move?
This corrected the issue for me. I'd be happy to submit a pr.
Hello Colin,
Thanks for the report and investigation! The docs for shutil.move()
say:
If the destination is on the current filesystem, then os.rename() is used. Otherwise, src is copied (using shutil.copy2()) to dst and then removed.
So it does sound like switching to shutil.move()
maintains the exact same behavior in the typical case, while transparently handling the copy operation when target is on another drive.
Please submit a PR with this change!