Crawk
Crawk

Reputation: 23

Why I receive ImportError: cannot import name 'fore' from 'colorama'?

I can execute colorama module and I receive an error. My code

from colorama import init
init()
from colorama import fore, back, style
what = input( print.red + "What kind of operation? (+, -, /, *): ")
a = float( input("Input first number?: ") )
b = float( input("Input second number: ") )
if what == "+":
    c = a + b
    print("Final: " + str(c))
if what == "-":
    c = a - b
    print("Final: " + str(c))
if what == "*":
    c = a * b
    print("Final: " + str(c))
if what == "/":
    c = a / b
    print("Final: " + str(c))
else:
    print("Please check operation")

And error

Traceback (most recent call last):
  File "D:/projects.py/calclulator.py", line 3, in <module>
    from colorama import fore, back, style
ImportError: cannot import name 'fore' from 'colorama' (D:\projects.py\venv\lib\site-packages\colorama\__init__.py)

Im using PyCharm as IDK When I running it without colorama i dont has any errors Help please!

Upvotes: 0

Views: 1657

Answers (1)

Seth
Seth

Reputation: 2369

The things you should be importing are Fore, Back, and Style. Watch out for those capital letters!

Upvotes: 0

Related Questions