Serene-Arc / bulk-downloader-for-reddit

Downloads and archives content from reddit
https://pypi.org/project/bdfr
GNU General Public License v3.0
2.3k stars 211 forks source link

[BUG] Specifying the log location on Windows creates one empty logfile too much. #883

Open Fakeaccount12312 opened 1 year ago

Fakeaccount12312 commented 1 year ago

Description

When --log is specified and there already is a file with the same name in the directory, bdfr adds .1/.2/... to the end of the filename, which is the desired behavior. However, for some reason at least on my WIndows machine it always creates one empty file too many, even when there is no file with this name already. So specifying --log log.txt in an empty directory for example creates the logfile log.txt and a empty log.txt.1 file. Running the command again fills this file with the log, but now a new empty log.txt.2 is created, and so on. This isn't a big issue, but deleting the superfluent log files manually is a bit annoying, and it shouldn't happen in the first place.

Command

bdfr download -l 147bge9 --log log.txt ""

Environment (please complete the following information)

Logs

[2023-06-12 07:26:46,245 - bdfr.connector - DEBUG] - Disabling the following modules: 
[2023-06-12 07:26:46,246 - bdfr.connector - Level 9] - Created download filter
[2023-06-12 07:26:46,246 - bdfr.connector - Level 9] - Created time filter
[2023-06-12 07:26:46,246 - bdfr.connector - Level 9] - Created sort filter
[2023-06-12 07:26:46,269 - bdfr.connector - Level 9] - Create file name formatter
[2023-06-12 07:26:46,269 - bdfr.connector - DEBUG] - Using unauthenticated Reddit instance
[2023-06-12 07:26:46,270 - bdfr.connector - Level 9] - Created site authenticator
[2023-06-12 07:26:46,270 - bdfr.connector - Level 9] - Retrieved subreddits
[2023-06-12 07:26:46,270 - bdfr.connector - Level 9] - Retrieved multireddits
[2023-06-12 07:26:46,270 - bdfr.connector - Level 9] - Retrieved user data
[2023-06-12 07:26:46,271 - bdfr.connector - Level 9] - Retrieved submissions for given links
[2023-06-12 07:26:46,765 - bdfr.downloader - DEBUG] - Attempting to download submission 147bge9
[2023-06-12 07:26:46,766 - bdfr.downloader - DEBUG] - Using Direct with url https://i.redd.it/peg1a673qh5b1.jpg
[2023-06-12 07:26:46,912 - bdfr.downloader - DEBUG] - Written file to C:\Users\user\Downloads\Temp\197\ORPHAN-OBLITERATOR_wizardposting_147bge9.jpg
[2023-06-12 07:26:46,912 - bdfr.downloader - DEBUG] - Hash added to master list: 07048d78dd98bfd6e424be0fd91997f6
[2023-06-12 07:26:46,912 - bdfr.downloader - INFO] - Downloaded submission 147bge9 from 197
[2023-06-12 07:26:46,912 - root - INFO] - Program complete
Serene-Arc commented 1 year ago

Couple questions here:

Fakeaccount12312 commented 1 year ago
Usage: bdfr download [OPTIONS] DIRECTORY

Error: Missing argument 'DIRECTORY'.
Fakeaccount12312 commented 1 year ago

whoops, didn't mean to do that, the issue still persists