Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to set temp directory when save dir and temp dir not in same partition, because os.replace doesn't support #27

Open
GingerManiac opened this issue Jun 22, 2020 · 2 comments

Comments

@GingerManiac
Copy link

GingerManiac commented Jun 22, 2020

unable to set temp directory when save dir and temp dir not in same partition, because os.replace doesn't support.

Exception in thread Watcher-3---(--):
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/--/workspace/github/showroom/showroom/core.py", line 487, in run
    self.download.wait()
  File "/home/--/workspace/github/showroom/showroom/downloader.py", line 187, in wait
    self.move_to_dest()
  File "/home/--/workspace/github/showroom/showroom/downloader.py", line 269, in move_to_dest
    destpath = self._move_to_dest(self.outfile, self.tempdir, self.destdir)
  File "/home/--/workspace/github/showroom/showroom/downloader.py", line 287, in _move_to_dest
    os.replace(srcpath, destpath)
OSError: [Errno 18] Invalid cross-device link: '/tmp/active/200621 Showroom - Oshi 180426.mp4' ->
   '/home/--/Downloads/Showroom/2020-06-21/Oshi/200621 Showroom - Oshi 180426.mp4'

i'm using seperated partitions and wish to set temp dir on /tmp on sda1 and save dir on /home on sdb1, but i couldn't do that, cuz of what i wrote above.
hope to be changed shutil.move rather than os.replace, then it will be fixed i think, if you don't mind, please.

@GingerManiac GingerManiac changed the title unable to set temp directory when save dir and temp dir not in save partition, because os.rename doesn't support unable to set temp directory when save dir and temp dir not in same partition, because os.rename doesn't support Jun 22, 2020
@GingerManiac GingerManiac changed the title unable to set temp directory when save dir and temp dir not in same partition, because os.rename doesn't support unable to set temp directory when save dir and temp dir not in same partition, because os.replace doesn't support Jun 23, 2020
@wlerin wlerin added the bug label Jul 1, 2020
@wlerin
Copy link
Owner

wlerin commented Sep 16, 2020

Honestly, you should probably just make sure your temp and save dir are on the same device. If they aren't the script will not perform as well.

Yes, changing os.replace to shutil.move would be easy and is probably what I should have been doing anyway, but same device moves are near-instantaneous. Copying from one device to another is not. The recording thread will be held up during this transfer, and if it's a false stop that means you're missing part of the recording while it copies over.

I could open a separate thread for the move, I guess. That's probably fine for the master branch, though the current working branch (hls-python) has too many threads as is.

@wlerin
Copy link
Owner

wlerin commented Jan 3, 2021

I've gone ahead and implemented this with 3f1a509 , but I'm going to leave the issue to remind myself both to address it on the hls-python branch, and to do something to avoid the copy blocking.

@wlerin wlerin added the triaged label Jan 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants