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

[BUG] Subreddits with only integers crash the program when specified in --opts #946

Open
3 tasks done
ymgenesis opened this issue Feb 19, 2024 · 0 comments
Open
3 tasks done
Labels
bug Something isn't working

Comments

@ymgenesis
Copy link

ymgenesis commented Feb 19, 2024

  • I am reporting a bug.
  • I am running the development branch
  • I have read the Opening an issue

Description

When a subreddit which has only integers is specified in --opts yaml.yaml under subreddit:, the program crashes with:
TypeError: expected string or bytes-like object, got 'int'

Both subreddits 1776 & 18_19 cause the crash. Wrapping them in double quotes seemed to fix the crash.

Command

bdfr download ./ --opts subreddits.yaml

subreddits.yaml:

verbose: true
authenticate: true
search_existing: true
no_dupes: true
sort: top
limit: 20
time: week
subreddit:
  - 1776

Environment (please complete the following information)

  • OS: macOS 13.4.1
  • Python version: 3.11

Logs

[2024-02-19 16:52:53,464 - bdfr.connector - DEBUG] - Disabling the following modules: 
[2024-02-19 16:52:53,464 - bdfr.connector - Level 9] - Created download filter
[2024-02-19 16:52:53,464 - bdfr.connector - Level 9] - Created time filter
[2024-02-19 16:52:53,465 - bdfr.connector - Level 9] - Created sort filter
[2024-02-19 16:52:53,468 - bdfr.connector - Level 9] - Create file name formatter
[2024-02-19 16:52:53,470 - bdfr.connector - DEBUG] - Using authenticated Reddit instance
[2024-02-19 16:52:53,471 - bdfr.connector - Level 9] - Created site authenticator
[2024-02-19 16:52:53,472 - root - ERROR] - Downloader exited unexpectedly - BDFR Downloader v2.7.0
Traceback (most recent call last):
  File "/Users/me/Documents/GitHub/bulk-downloader-for-reddit/bdfr/__main__.py", line 122, in cli_download
    reddit_downloader = RedditDownloader(config, [stream])
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/me/Documents/GitHub/bulk-downloader-for-reddit/bdfr/downloader.py", line 42, in __init__
    super().__init__(args, logging_handlers)
  File "/Users/me/Documents/GitHub/bulk-downloader-for-reddit/bdfr/connector.py", line 66, in __init__
    self.reddit_lists = self.retrieve_reddit_lists()
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/me/Documents/GitHub/bulk-downloader-for-reddit/bdfr/connector.py", line 188, in retrieve_reddit_lists
    master_list.extend(self.get_subreddits())
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/me/Documents/GitHub/bulk-downloader-for-reddit/bdfr/connector.py", line 289, in get_subreddits
    for reddit in self.split_args_input(self.args.subreddit) | subscribed_subreddits:
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/me/Documents/GitHub/bulk-downloader-for-reddit/bdfr/connector.py", line 272, in split_args_input
    results = re.split(split_pattern, entry)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/re/__init__.py", line 206, in split
    return _compile(pattern, flags).split(string, maxsplit)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'int'
@ymgenesis ymgenesis added the bug Something isn't working label Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant