Repository: Serene-Arc/bulk-downloader-for-reddit

Issue #656: [BUG] Errno 63 - File name too long on MacOS when writing to APFS
Created: 2022-09-09T06:33:45Z
[ X ] I am reporting a bug.
[ X ] I am running the latest version of BDfR
[ X ] I have read the Opening an issue

Description
File name too long on Mac OS when writing to external APFS drive. Specified as '[Errno 63]' Log attached below.
Command
python3 -m pip install bdfr --upgrade
python3 -m bdfr clone '<DIR>' --folder-scheme '{SUBREDDIT}/{TITLE}-{POSTID}' --format yaml --user me --saved --authenticate --no-dupes --file-scheme '{POSTID}-{DATE}'

Environment (please complete the following information):

OS: macOS Monterey Version 12.5.1
Python version: Python 3.9.6 (v3.9.6)
Target Drive Format: APFS

Logs
`Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/bdfr/__main__.py", line 154, in <module>
    cli()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/bdfr/__main__.py", line 120, in cli_clone
    reddit_scraper.download()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/bdfr/cloner.py", line 20, in download
    self._download_submission(submission)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/bdfr/downloader.py", line 84, in _download_submission
    if destination.exists():
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1414, in exists
    self.stat()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1222, in stat
    return self._accessor.stat(self)
OSError: [Errno 63] File name too long: '/<OP_REDACTED>/homelab/Got a PowerEdge from work decked out with 96GB of RAM and added in my drives. After hours over a couple of nights of tinkering, got UNRAID configured for the first time in a year and got the RAID card in IT mode. A little dated but so nice having the HDD carriages.-vi6mq3/vi6mq3-2022-06-22T09:32:03.jpg'`

Duplicate issue #718: [BUG] Tool crashes filename too long
Created: 2022-12-12T11:09:33Z
[ X] I am reporting a bug.
[ X I am running the latest version of BDfR
[ X] I have read the Opening an issue

Description
Traceback (most recent call last):
File "/Users/roy/Library/Python/3.9/bin/bdfr", line 8, in 
sys.exit(cli())
File "/Users/roy/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/Users/roy/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/roy/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/roy/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/roy/Library/Python/3.9/lib/python/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/roy/Library/Python/3.9/lib/python/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/Users/roy/Library/Python/3.9/lib/python/site-packages/bdfr/main.py", line 91, in cli_download
reddit_downloader.download()
File "/Users/roy/Library/Python/3.9/lib/python/site-packages/bdfr/downloader.py", line 47, in download
self._download_submission(submission)
File "/Users/roy/Library/Python/3.9/lib/python/site-packages/bdfr/downloader.py", line 105, in _download_submission
if destination.exists():
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1414, in exists
self.stat()
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1222, in stat
return self._accessor.stat(self)
OSError: [Errno 63] File name too long:
Command
cat Subreddits.txt | xargs -L 1 echo --subreddit | xargs -L 50 bdfr download /Volumes/Adult/Web/Reddit/Subreddits --no-dupes --search-existing --skip txt
Environment (please complete the following information)

OS: MacOS Ventura
Python version: 3.9

Closing comment (2022-12-12T12:27:25Z): I'm guessing that this is a duplicate of #656. It looks like you're downloading to an external volume @BeachNL, is this the case? Either a network drive or a HDD with a different filesystem.
The issue is that the BDFR can't tell what filesystem you're writing to, only what the OS is. We configure the path lengths based on the OS but with Mac/Linux, they are more permissive (better) than other filesystems, so this error happens because you're basically tricking the BDFR into thinking the files can be a certain length when they can't.