-
Notifications
You must be signed in to change notification settings - Fork 119
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
ValueError: invalid literal for int() with base 10 #61
Comments
I found an copyright free example epub that causes the error. Feel free to use this one to reproduce the issue, or if it is environmental, maybe you will not get the error. |
I managed to fix it. I added a try except block around the int parser, and now it doesn't crash: def parse_text(self):
if not "[pause:" in self.text:
return [(0, self.text)]
parts = self.text.split("[pause:")
for part in parts:
if "]" in part:
pause_time, content = part.split("]", 1)
try:
yield int(pause_time), content.strip()
except ValueError:
yield 0, content.strip()
else:
content = part
yield 0, content.strip() |
Thank you @LarsHLunde, haven't got chance to test dege13's doc. However, it worked perfectly on my books, which are failing before the fix. |
Hello, I ran into this problem with edge on Windows and MacOS, but it was not an issue when using docker. I did some investigating which may be interesting or useful, before finding this issue with your solution. The docker uses python 3.11 so I thought that might be it, but forcing python 3.11 on MacOS still resulted in the same error. The contents of edge_tts_provider.py is identical in the docker. Here are the different modules, where docker is using the older version, so probably one of these is to blame.
|
The fix from @LarsHLunde works for me. I'm guessing it breaks when the text itself has a ] in it maybe? Something like this could be a fix? (not proper code just expressing the idea)
Also I'm confused because the comment on the code says
But that example would throw an error when it tries to do |
Just made a new release to address issues related with edge tts feature. https://github.com/p0n1/epub_to_audiobook/releases/tag/v0.6.0 |
I keep hitting this error with several books. Any ideas what is wrong?
Using the command python main.py --tts edge
Running on Windows.
I also have these warnings before the processing happens, but some books do succeed so I don't think these warnings should actually matter.
The text was updated successfully, but these errors were encountered: