shadowmoose / RedditDownloader

Scrapes Reddit to download media of your choice.
1.11k stars 99 forks source link

Download logic seems to expect Windows? #23

Closed parkerlreed closed 6 years ago

parkerlreed commented 6 years ago

(To get this running I quickly updated my 2FA code in the setting.json, saved, and ran the script)

[parker@inspiron15 RedditDownloader]$ python main.py 

====================================
    Reddit Media Downloader 2.0
====================================
    (By ShadowMoose @ Github)

Loading all settings from file.
Loaded Source:  Source1
Authenticating via OAuth...
Authenticated as [parkerlreed]

Downloading from Source: Source1
Element loading complete.

Loaded handlers:  imgur, github, reddit, ytdl, newspaper
Loaded handlers:  imgur, github, reddit, ytdl, newspaper
Loaded handlers:  imgur, github, reddit, ytdl, newspaper
Loaded handlers:  imgur, github, reddit, ytdl, newspaper
Loaded handlers:  imgur, github, reddit, ytdl, newspaper
Traceback (most recent call last):
  File "main.py", line 228, in <module>
    p.run()
  File "main.py", line 124, in run
    self.processor.run()
  File "./classes/processing/elementprocessor.py", line 40, in run
    self.redraw(clear, q)
  File "./classes/processing/elementprocessor.py", line 92, in redraw
    print(out.rstrip(), end='')
  File "/usr/lib/python3.6/site-packages/colorama/ansitowin32.py", line 40, in write
    self.__convertor.write(text)
  File "/usr/lib/python3.6/site-packages/colorama/ansitowin32.py", line 141, in write
    self.write_and_convert(text)
  File "/usr/lib/python3.6/site-packages/colorama/ansitowin32.py", line 167, in write_and_convert
    self.convert_ansi(*match.groups())
  File "/usr/lib/python3.6/site-packages/colorama/ansitowin32.py", line 181, in convert_ansi
    self.call_win32(command, params)
  File "/usr/lib/python3.6/site-packages/colorama/ansitowin32.py", line 212, in call_win32
    winterm.erase_screen(params[0], on_stderr=self.on_stderr)
AttributeError: 'NoneType' object has no attribute 'erase_screen'
shadowmoose commented 6 years ago

Hmm, interesting... The console formatting library seems to be trying to reference a character (one used to clear the terminal) that it doesn't have. It's been tested on Win/Ubuntu, but there are probably unforeseen issues that vary with the terminal.

At any rate, I know what's happening here. I'll roll out a fix for this problem in a bit.

shadowmoose commented 6 years ago

(As a side note, it should be able to detect when the program is run without a terminal it can "pretty print" to. If you were looking to bypass this issue for the time being, running the script and piping the output to anything else first should work.)

parkerlreed commented 6 years ago

Haha nice

python main.py > test.txt

Another terminal

tail -f test.txt

Works

parkerlreed commented 6 years ago

Multi threading working nicely!

shadowmoose commented 6 years ago

Glad to hear it, thanks for testing that out. I expect to have a built-in patch for unsupported consoles sometime soon. It mostly depends on any other bugs that pop up following the 2.0 changes.

shadowmoose commented 6 years ago

This should be patched on the live branch, pending testing, and will be rolled out officially in the next release soon.

parkerlreed commented 6 years ago

Works!