meeb / bandcampsync

Downloads your Bandcamp purchases automatically
BSD 3-Clause "New" or "Revised" License
156 stars 9 forks source link

OSError: [Errno 28] No space left on device #6

Closed JamesDBartlett3 closed 1 year ago

JamesDBartlett3 commented 1 year ago

Hardware

Software

Error message

2023-10-06 09:41:40,514 sync [INFO] Decompressing downloaded zip "/tmp/tmpaha9l3q0" to "/tmp/tmptw08xjje" Traceback (most recent call last): File "/home/pi/.local/bin/bandcampsync", line 41, in do_sync(cookies_path, cookies, dir_path, media_format) File "/home/pi/.local/lib/python3.9/site-packages/bandcampsync/init.py", line 54, in do_sync unzip_file(temp_file.name, temp_dir) File "/home/pi/.local/lib/python3.9/site-packages/bandcampsync/download.py", line 82, in unzip_file z.extractall(decompress_to) File "/usr/lib/python3.9/zipfile.py", line 1633, in extractall self._extract_member(zipinfo, path, pwd) File "/usr/lib/python3.9/zipfile.py", line 1688, in _extract_member shutil.copyfileobj(source, target) File "/usr/lib/python3.9/shutil.py", line 208, in copyfileobj fdst_write(buf) OSError: [Errno 28] No space left on device

Diagnosis

I believe this error is due to an unfortunate collision between bandcampsync's default temp storage location and OpenMediaVault's overabundance of caution with regards to flash-based storage devices. Here's what I think is happening:

Possible solution

One way to avoid this problem would be to add an optional temp directory preference parameter (-t/--temp, perhaps?) to bandcampsync, with several options:

Willing to help develop & test

I'm more than willing to help develop and test a solution to this problem, but I'm not sure where to start. I've done a fair amount of Python development, though I have never created a pip package or Docker container, written CI/CD tests of any kind, etc. If you can guide me through the process of getting a local dev environment up and running, then I'd be happy to take a crack at adding the -t parameter myself, and submitting a PR once it's done.

badboy commented 1 year ago

Have you tried setting one of TMPDIR, TEMP or TMP as an environment variable? Looks like bandcampsync uses Python's tempfile, which should respect any of those variables.

JamesDBartlett3 commented 1 year ago

Have you tried setting one of TMPDIR, TEMP or TMP as an environment variable? Looks like bandcampsync uses Python's tempfile, which should respect any of those variables.

Yep, I already applied that workaround on my system. However, I still think every app should let users specify where it should save its files, even the temporary ones.

meeb commented 1 year ago

Thanks, this was a reasonable suggestion. While setting the TEMP ENV var is widely known, adding a flag to manually specify the temp directory path is a nice to have feature. This is in the newly released v0.3.4.

JamesDBartlett3 commented 1 year ago

Wow, that was an incredibly fast turnaround, and thanks for taking my suggestion! Also, FYI, here's where I first heard about your tool the other day, just in case you'd like to engage in the conversation there: @oleksiy@sonomu.club on Mastodon

meeb commented 1 year ago

No problem, adding a CLI arg and a single parameter isn't exactly much work :)