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

FileNotFoundError #4

Closed
mikan01 opened this issue Apr 5, 2020 · 6 comments
Closed

FileNotFoundError #4

mikan01 opened this issue Apr 5, 2020 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@mikan01
Copy link

mikan01 commented Apr 5, 2020

Program gets aborted at this particular book with FileNotFoundError

[.] Json dump for book https://www*blinkist*com/en/books/the-five-most-important-questions-you-will-ever-ask-about-your-organization-en already exixts, skipping scraping...
[.] Downloading audio file for blink 0...
[.] Downloading audio file for blink 1...
[.] Downloading audio file for blink 2...
[.] Downloading audio file for blink 3...
[.] Downloading audio file for blink 4...
[.] Downloading audio file for blink 5...
[.] Downloading audio file for blink 6...
[.] Combining audio files for the-five-most-important-questions-you-will-ever-ask-about-your-organization-en
[!] ffmpeg output file longer than 260 characters. Trying shorter filename...
[.] Generating .html for the-five-most-important-questions-you-will-ever-ask-about-your-organization-en
Traceback (most recent call last):
File "main.py", line 69, in
processed_books = process_book_json(book_json, processed_books)
File "main.py", line 29, in process_book_json
generator.generate_book_html(book_json)
File "C:\Users\Fang Yuan\Downloads\blinkist-scraper-master\generator.py", line 42, in generate_book_html
with open(html_file, 'w', encoding='utf-8') as outfile:
FileNotFoundError: [Errno 2] No such file or directory: 'books\Entrepreneurship\Peter F Drucker - The Five Most Important Questions You Will Ever Ask About Your Organization\Peter F Drucker - The Five Most Important Questions You Will Ever Ask About Your Organization.html'

@leoncvlt
Copy link
Owner

leoncvlt commented Apr 5, 2020

Looking at that last filename I get the feeling that the path might have still ended up being longer than 260 characters (even if the script is trying to use a short filename) which causes issues with ffmpeg on Windows. Could you try running the script from a short location (e.g put it in C:/test or something like that)?

@mikan01
Copy link
Author

mikan01 commented Apr 6, 2020

It worked, thank you!!

@leoncvlt leoncvlt added the bug Something isn't working label Apr 6, 2020
@leoncvlt leoncvlt self-assigned this Apr 6, 2020
@leoncvlt
Copy link
Owner

leoncvlt commented Apr 6, 2020

Would still like for this to be handled properly (I thought it only bugged ffmpeg but apparently the html file doesn't like this either), so I'll leave this open and have a look at it.

@mikan01
Copy link
Author

mikan01 commented Apr 6, 2020

ohhh, I stumbled upon the same error again even though I renamed the parent directory to just alphabet "B" in C Drive.

[.] Json dump for book https*://wwwblinkistcom/en/books/becoming-an-exceptional-executive-coach-en already exixts, skipping scraping...
[.] Book becoming-an-exceptional-executive-coach-en does not have audio blinks, skipping scraping audio...
[.] Generating .html for becoming-an-exceptional-executive-coach-en
Traceback (most recent call last):
File "main.py", line 69, in
processed_books = process_book_json(book_json, processed_books)
File "main.py", line 29, in process_book_json
generator.generate_book_html(book_json)
File "C:\b\generator.py", line 42, in generate_book_html
with open(html_file, 'w', encoding='utf-8') as outfile:
FileNotFoundError: [Errno 2] No such file or directory: 'books\Communication Skills\Michael Frisch, Robert Lee, Karen L Metzger, Jeremy Robinson and Judy Rosemarin - Becoming an Exceptional Executive Coach\Michael Frisch, Robert Lee, Karen L Metzger, Jeremy Robinson and Judy Rosemarin - Becoming an Exceptional Executive Coach.html'

@mikan01
Copy link
Author

mikan01 commented Apr 9, 2020

ohhh, I stumbled upon the same error again even though I renamed the parent directory to just alphabet "B" in C Drive.

[.] Json dump for book https*://www_blinkist_com/en/books/becoming-an-exceptional-executive-coach-en already exixts, skipping scraping...
[.] Book becoming-an-exceptional-executive-coach-en does not have audio blinks, skipping scraping audio...
[.] Generating .html for becoming-an-exceptional-executive-coach-en
Traceback (most recent call last):
File "main.py", line 69, in
processed_books = process_book_json(book_json, processed_books)
File "main.py", line 29, in process_book_json
generator.generate_book_html(book_json)
File "C:\b\generator.py", line 42, in generate_book_html
with open(html_file, 'w', encoding='utf-8') as outfile:
FileNotFoundError: [Errno 2] No such file or directory: 'books\Communication Skills\Michael Frisch, Robert Lee, Karen L Metzger, Jeremy Robinson and Judy Rosemarin - Becoming an Exceptional Executive Coach\Michael Frisch, Robert Lee, Karen L Metzger, Jeremy Robinson and Judy Rosemarin - Becoming an Exceptional Executive Coach.html'

Fixed the issue by following the below guide

https://www.itprotoday.com/windows-10/enable-long-file-name-support-windows-10

@leoncvlt
Copy link
Owner

Great! I should have fixed this in the script with 8c5e51a, but that's good to know - guess it explains why I wasn't being able to replicate this, I probably enabled that on my system a long time ago. I'll add a little blurb in the readme about this just in case! 😉

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