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] AttributeError: 'WindowsPath' object has no attribute 'gen' #510

Closed
3 tasks done
AlessandroDiGioacchino opened this issue Aug 16, 2021 · 2 comments
Closed
3 tasks done
Assignees
Labels
bug Something isn't working

Comments

@AlessandroDiGioacchino
Copy link

AlessandroDiGioacchino commented Aug 16, 2021

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

Description

There isn't much to say… I literally can't run the program
it doesn't even ask for authentication.

Command

py -m bdfr download '.\From-Reddit\' --authenticate --saved -u me --no-dupes --file-scheme '{SUBREDDIT}_{TITLE}_{POSTID}'

Environment

  • OS: Windows 10
  • Python version: 3.10.0rc1 (I hope this isn't the reason why BDfR doesn't work)

Logs

No file whatsoever in C:\Users\[REDACTED]\AppData\Local\BDFR\bdfr
Hopefully the traceback can be of some use though.

Traceback (most recent call last):
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python310\lib\site-packages\bdfr\__main__.py", line 152, in <module>
    cli()
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1668, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python310\lib\site-packages\click\decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python310\lib\site-packages\bdfr\__main__.py", line 80, in cli_download
    reddit_downloader = RedditDownloader(config)
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python310\lib\site-packages\bdfr\downloader.py", line 38, in __init__
    super(RedditDownloader, self).__init__(args)
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python310\lib\site-packages\bdfr\connector.py", line 56, in __init__
    self._setup_internal_objects()
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python310\lib\site-packages\bdfr\connector.py", line 62, in _setup_internal_objects
    self.load_config()
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python310\lib\site-packages\bdfr\connector.py", line 187, in load_config
    self.config_location = list(importlib.resources.path('bdfr', 'default_config.cfg').gen)[0]
AttributeError: 'WindowsPath' object has no attribute 'gen'
@AlessandroDiGioacchino AlessandroDiGioacchino added the bug Something isn't working label Aug 16, 2021
@Serene-Arc Serene-Arc self-assigned this Aug 17, 2021
@Serene-Arc
Copy link
Owner

@DigiOhhh I'll investigate this issue. In the meantime, a fix would be to specify a configuration file yourself. This code is only run as a "last resort" to try and find a config file included with the package, but it's obviously not working on Windows. If you specify one yourself, like downloading the one included here on GitHub, it should work without crashing

@AlessandroDiGioacchino
Copy link
Author

AlessandroDiGioacchino commented Aug 17, 2021

Ok, now it's working.
For anyone who might need it, this is the default configuration file: https://github.com/aliparlakci/bulk-downloader-for-reddit/blob/900f9a93ee89ea3673fb1300d8d7bd4b4850ff8f/bdfr/default_config.cfg#L1-L7

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

2 participants