JasonLovesDoggo / RedditVideoMakerBot

Create Reddit Videos with just✨ one command ✨
GNU General Public License v3.0
23 stars 13 forks source link

AttributeError: 'NoneType' object has no attribute 'upper' when fetching Reddit darkmode #31

Closed jacobjake1 closed 2 years ago

jacobjake1 commented 2 years ago

Saved Text to MP3 files Successfully. ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ Downloading Screenshots of Reddit Posts 📷 │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Launching Headless Browser... Traceback (most recent call last): File "main.py", line 39, in main() File "main.py", line 31, in main download_screenshots_of_reddit_posts(reddit_object, number_of_comments) File "C:\Users\jacob\Desktop\redditest\video_creation\screenshot_downloader.py", line 28, in download_screenshots_of_reddit_posts if getenv("THEME").upper() == "DARK": AttributeError: 'NoneType' object has no attribute 'upper'

jacobjake1 commented 2 years ago

Also getting this....

Received subreddit threads Successfully. ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ Saving Text to MP3 files 🎶 │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Saving... ---------------------------------------- 3.5 it/s Traceback (most recent call last): File "C:\Users\jacob\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\mutagen_util.py", line 251, in _openfile fileobj = open(filename, "rb+" if writable else "rb") FileNotFoundError: [Errno 2] No such file or directory: 'assets/temp/mp3/2.mp3'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\jacob\Desktop\redditest\video_creation\voices.py", line 38, in save_text_to_mp3 length += MP3(f"assets/temp/mp3/{idx}.mp3").info.length File "C:\Users\jacob\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\mutagen_file.py", line 48, in init self.load(*args, **kwargs) File "C:\Users\jacob\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\mutagen_util.py", line 155, in wrapper writable, create) as h: File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64qbz5n2kfra8p0\lib\contextlib.py", line 112, in enter__ return next(self.gen) File "C:\Users\jacob\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\mutagen_util.py", line 272, in _openfile raise MutagenError(e) mutagen.MutagenError: [Errno 2] No such file or directory: 'assets/temp/mp3/2.mp3'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "main.py", line 39, in main() File "main.py", line 30, in main length, number_of_comments = save_text_to_mp3(reddit_object) File "C:\Users\jacob\Desktop\redditest\video_creation\voices.py", line 40, in save_text_to_mp3 length = sox.file_info.duration(f"assets/temp/mp3/{idx}.mp3") File "C:\Users\jacob\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sox\file_info.py", line 121, in duration validate_input_file(input_filepath) File "C:\Users\jacob\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sox\file_info.py", line 249, in validate_input_file "input_filepath {} does not exist.".format(input_filepath) OSError: input_filepath assets/temp/mp3/2.mp3 does not exist.

yamanos commented 2 years ago

Having the same issue. Has anyone found the fix?

JasonLovesDoggo commented 2 years ago

gimme 10mins

JasonLovesDoggo commented 2 years ago

Saved Text to MP3 files Successfully. ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ Downloading Screenshots of Reddit Posts 📷 │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Launching Headless Browser... Traceback (most recent call last): File "main.py", line 39, in main() File "main.py", line 31, in main download_screenshots_of_reddit_posts(reddit_object, number_of_comments) File "C:\Users\jacob\Desktop\redditest\video_creation\screenshot_downloader.py", line 28, in download_screenshots_of_reddit_posts if getenv("THEME").upper() == "DARK": AttributeError: 'NoneType' object has no attribute 'upper'

That just means that the THEME variable isn't set

JasonLovesDoggo commented 2 years ago

Saved Text to MP3 files Successfully. ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ Downloading Screenshots of Reddit Posts 📷 │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Launching Headless Browser... Traceback (most recent call last): File "main.py", line 39, in main() File "main.py", line 31, in main download_screenshots_of_reddit_posts(reddit_object, number_of_comments) File "C:\Users\jacob\Desktop\redditest\video_creation\screenshot_downloader.py", line 28, in download_screenshots_of_reddit_posts if getenv("THEME").upper() == "DARK": AttributeError: 'NoneType' object has no attribute 'upper'

That just means that the THEME variable isn't set

To set it just go to the .env file.