4

ImportError: cannot import name 'gTTS' from partially initialized module 'gtts' (most likely due to a circular import) (C:\Users\Gayathri Sai\PycharmProjects\audibook\gtts.py)

vcscharan
  • 41
  • 3

4 Answers4

3

Looks like you're testing Google's Text-to-Speech and you innocently named your python file "gtts.py"(happened to me too). This conflicts with the import so you should rename your file to something else(e.g. test_gtts.py)

Jacobski
  • 741
  • 6
  • 10
0

replace your imports with (Note the capital S at the end)

from gtts import gTTS

assuming you have it installed .

Shabari nath k
  • 920
  • 1
  • 10
  • 23
0

You want to import gtts, but the name of your file is gtts. So python doesn't know which one you want to import, the solution is simple just rename file in a way that doesn't interfere with the module's name.

Raúl Peñate
  • 342
  • 5
  • 15
0

I think your python file name is gtts.py that why is error is occur. change your file name.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 04 '22 at 07:50
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/31451261) – Muhammad Mohsin Khan Apr 05 '22 at 09:41