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

AttributeError: 'CommWithPauses' object has no attribute 'text'. Did you mean: 'texts'? #68

Open
Troyificus opened this issue Jun 7, 2024 · 1 comment

Comments

@Troyificus
Copy link

Running this for the first time and getting this error message. This is the log from the terminal;

G:\Epub to Audiobook\epub_to_audiobook>python main.py Input\V.epub Output --tts edge
C:\Users\Trism\AppData\Local\Programs\Python\Python310\lib\site-packages\ebooklib\epub.py:1395: UserWarning: In the future version we will turn default option ignore_ncx to True.
  warnings.warn('In the future version we will turn default option ignore_ncx to True.')
C:\Users\Trism\AppData\Local\Programs\Python\Python310\lib\site-packages\ebooklib\epub.py:1423: FutureWarning: This search incorrectly ignores the root element, and will be fixed in a future version.  If you rely on the current behaviour, change it to './/xmlns:rootfile[@media-type]'
  for root_file in tree.findall('//xmlns:rootfile[@media-type]', namespaces={'xmlns': NAMESPACES['CONTAINERNS']}):
G:\Epub to Audiobook\epub_to_audiobook\audiobook_generator\tts_providers\base_tts_provider.py:14: RuntimeWarning: coroutine 'EdgeTTSProvider.validate_config' was never awaited
  self.validate_config()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
G:\Epub to Audiobook\epub_to_audiobook\audiobook_generator\book_parsers\epub_book_parser.py:47: XMLParsedAsHTMLWarning: It looks like you're parsing an XML document using an HTML parser. If this really is an HTML document (maybe it's XHTML?), you can ignore or filter this warning. If it's XML, you should know that using an XML parser will be more reliable. To parse this document as XML, make sure you have the lxml package installed, and pass the keyword argument `features="xml"` into the BeautifulSoup constructor.
  soup = BeautifulSoup(content, "lxml")
2024-06-07 20:59:57 [INFO] Chapters count: 81.
2024-06-07 20:59:57 [INFO] Converting chapters from 1 to 81.
2024-06-07 20:59:57 [INFO] ✨ Total characters in selected book: 613505 ✨
Estimate book voiceover would cost you roughly: $0.00

Do you want to continue? (y/n)
y
2024-06-07 21:00:02 [INFO] Converting chapter 1/81: Deadly_Offer, characters: 62
Traceback (most recent call last):
  File "G:\Epub to Audiobook\epub_to_audiobook\main.py", line 139, in <module>
    main()
  File "G:\Epub to Audiobook\epub_to_audiobook\main.py", line 135, in main
    AudiobookGenerator(config).run()
  File "G:\Epub to Audiobook\epub_to_audiobook\audiobook_generator\core\audiobook_generator.py", line 101, in run
    tts_provider.text_to_speech(
  File "G:\Epub to Audiobook\epub_to_audiobook\audiobook_generator\tts_providers\edge_tts_provider.py", line 157, in text_to_speech
    asyncio.run(
  File "C:\Users\Trism\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\Trism\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
    return future.result()
  File "G:\Epub to Audiobook\epub_to_audiobook\audiobook_generator\tts_providers\edge_tts_provider.py", line 101, in save
    await self.chunkify()
  File "G:\Epub to Audiobook\epub_to_audiobook\audiobook_generator\tts_providers\edge_tts_provider.py", line 65, in chunkify
    for pause_time, content in self.parsed:
  File "G:\Epub to Audiobook\epub_to_audiobook\audiobook_generator\tts_providers\edge_tts_provider.py", line 51, in parse_text
    if not "[pause:" in self.text:
AttributeError: 'CommWithPauses' object has no attribute 'text'. Did you mean: 'texts'?

Any idea what's gone wrong?

@p0n1
Copy link
Owner

p0n1 commented Jun 28, 2024

I got this error when I upgraded the edge_tts to a new version. It modified its interface in 6.1.12. Maybe you just used the previous code with the latest edge_tts.

You can update to the latest release https://github.com/p0n1/epub_to_audiobook/releases/tag/v0.6.0 by git pull, run pip install -r requirements.txt, and try again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants