bulk-downloader-for-reddit icon indicating copy to clipboard operation
bulk-downloader-for-reddit copied to clipboard

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

Open Fakeaccount12312 opened this issue 1 year ago • 3 comments

  • [x] I am reporting a bug.
  • [x] I am running the latest version of BDfR
  • [x] I have read the Opening an issue

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)

  • OS: Windows 10
  • Python version: 3.9.4
  • Shell: Git Bash

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

Fakeaccount12312 avatar Jun 12 '23 05:06 Fakeaccount12312

Couple questions here:

  • Are you running this on Windows and directing it to a location on the same machine? Not a network share but something connected by a physical connection with the NTFS file system?
  • Are you including the extra "" quotes in the command? What is the purpose that this argument fulfills?
  • Does this happen when you don't include that last argument?

Serene-Arc avatar Jun 15 '23 03:06 Serene-Arc

  • Yes, a normal location on my Windows machine with a NTFS file system. To be more exact, simply the SSD on my Laptop.
  • The quotes are the directory, so the current one, as this argument has to be specified.
  • No, since the command does not run without specifying a directory. It just returns this message:
Usage: bdfr download [OPTIONS] DIRECTORY

Error: Missing argument 'DIRECTORY'.

Fakeaccount12312 avatar Oct 11 '23 16:10 Fakeaccount12312

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

Fakeaccount12312 avatar Oct 11 '23 16:10 Fakeaccount12312