vcscharan
vcscharan

Reputation: 41

cannot import name 'gTTS' from partially initialized module 'gtts'

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)

Upvotes: 4

Views: 2058

Answers (4)

kushalpatel932
kushalpatel932

Reputation: 1

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

Upvotes: 0

Jacobski
Jacobski

Reputation: 771

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)

Upvotes: 3

Raúl Peñate
Raúl Peñate

Reputation: 607

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.

Upvotes: 0

Shabari nath k
Shabari nath k

Reputation: 890

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

from gtts import gTTS

assuming you have it installed .

Upvotes: 0

Related Questions