Typeerror bool object is not callable

Typeerror bool object is not callable

I am brand new to python. I got a error

Would you please instruct how to solve this issue? The first "if" check is fine, but "while not" has this error.

2 Answers 2

You do cls.isFilled = True . That overwrites the method called isFilled and replaces it with the value True. That method is now gone and you can’t call it anymore. So when you try to call it again you get an error, since it’s not there anymore.

The solution is use a different name for the variable than you do for the method.

Actually you can fix it with following steps —

  1. Do cls.__dict__
  2. This will give you dictionary format output which will contain <‘isFilled’:True>or <‘isFilled’:False>depending upon what you have set.
  3. Delete this entry — del cls.__dict__[‘isFilled’]
  4. You will be able to call the method now.

In this case, we delete the entry which overrides the method as mentioned by BrenBarn.

Not the answer you’re looking for? Browse other questions tagged python or ask your own question.

Linked

Related

Hot Network Questions

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2020 Stack Exchange Inc; user contributions licensed under cc by-sa 4.0 with attribution required. rev 2020.3.25.36371

Comments

Copy link Quote reply

jerrypy commented Sep 16, 2015

I followed your book to learn flask, it works very well until I used current_user , I got

this kind of error. I thought maybe there’re some mistakes in my code, so I download your code from github, and checkout to branch 8c , but same thing happend, check traceback message below:

Читайте также:  Мульти приставка к телевизору

Here is the version of some related package I’m using:

Thank you so much if you can help me solve this problem.

This comment has been minimized.

Copy link Quote reply

jerrypy commented Sep 16, 2015

I’ve already solved this problem.
Since 0.3.0, Flask-Login has set is_active is_authenticated is_anonymous to property in UserMixin , so we should use current_user.is_authenticated instead of current_user.is_authenticated() .

This comment has been minimized.

Copy link Quote reply

miguelgrinberg commented Sep 17, 2015

@jerrypy Wow, that is a pretty awful change that is going to break every application. Thanks for doing the research. Not sure how I’ll handle this, need to think about it.

This comment has been minimized.

Copy link Quote reply

ghost commented Sep 17, 2015

@jerrypy Thanks, I also met this problem some days ago.

This comment has been minimized.

Copy link Quote reply

florianperrenet commented Sep 17, 2015

also had this problem, thanks @jerrypy for solving this!

This comment has been minimized.

Copy link Quote reply

miguelgrinberg commented Sep 21, 2015

The repo has been updated to work with Flask-Login 0.3.0. I’ve added an errata entry for this problem on the flaskbook.com site.

This comment has been minimized.

Copy link Quote reply

fireflystar commented Oct 1, 2015

hello @miguelgrinberg ,i git clone flasky project on github,i met this problem today。
do we have a new version of flasky ? how could we get it?

This comment has been minimized.

Copy link Quote reply

ryanhartje commented Oct 7, 2015

This comment has been minimized.

Copy link Quote reply

volosovich commented Oct 21, 2015

@jerrypy Thank you very much.

Читайте также:  Драйвера для depo ego

This comment has been minimized.

Copy link Quote reply

JJVvV commented Nov 4, 2015

@jerrypy Thanks very much ! It botherd me several hours.

This comment has been minimized.

Copy link Quote reply

ResidentMario commented Nov 10, 2015

The docs are wrong! If possible please update the documentation (at https://flask-login.readthedocs.org/en/latest/#your-user-class) to document this change, I had to employ Google-fu to solve this issue.

This comment has been minimized.

Copy link Quote reply

miguelgrinberg commented Nov 10, 2015

@ResidentMario I agree with you. In my opinion this change causes more trouble than its worth, and if it was up to me I would have never made it. Unfortunately the maintainer of Flask-Login has different views, he seems to not be too concerned about backwards compatibility.

I have updated the Flasky repository, and also added the changes to the book errata. Whenever O’Reilly reprints the book, the correct code will be used. I know it isn’t much, but unfortunately I cannot do more from my side.

Hopefully Google will send people having the problem to this page, where the situation is explained.

код программы (перевод времени из одного типа в другой)

in_time = (int ( "raw_input" ( "Input time value:" ) ) )
in_tipe = (str ( "raw_input" ( "Input value type (s.m.h):" ) ) )
convert_to = (raw_input ( "Input out value type (s,m,h):" ) )

if int_type == "h":
if convert_to == "s":
result = in_time * 60 * 60

if convert_to == "m":
result = in_time * 60

if in_type == "m":
if convert_to == "s":
result = in_time * 60

if convert_to == "h":
result = float (in_time) / 60

print ("Convertation result:")
print (in_time, in_type, " equal ", result, convert_to)

Читайте также:  Watsapp ru web для windows 7

пользуюсь python 3.3 и sublim text 2, не понимаю в чем причина ошибки

1) Если имелась ввиду функция raw_input, то двойные скобки тут не нужны.
2) В Python 3.0 и выше функция raw_input переименована в input
3) Есть еще пара неправильно написанных переменных

in_time = (int ( input ( "Input time value:" ) ) )
in_type = (str ( input ( "Input value type (s.m.h):" ) ) )
convert_to = (input ( "Input out value type (s,m,h):" ) )

if in_type == "h":
&nbsp&nbsp&nbsp&nbspif convert_to == "s":
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspresult = in_time * 60 * 60

if convert_to == "m":
&nbsp&nbsp&nbsp&nbspresult = in_time * 60

if in_type == "m":
&nbsp&nbsp&nbsp&nbspif convert_to == "s":
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspresult = in_time * 60

if convert_to == "h":
&nbsp&nbsp&nbsp&nbspresult = float (in_time) / 60

Ссылка на основную публикацию
Open systems interconnection basic reference model
В настоящее время в телекоммуникационных системах используются многостороннее оборудование: каналообразующее, коммутационное, базы данных и мн. др., выполненное различными производителями (вендорами)...
Faster charging technology samsung
Кирилл Сергеев Подбираем аксессуар для быстрой зарядки смартфона и стараемся не ошибиться. Идея для этого материала появилась у меня в...
Fdm печать что это
FFF (Fused Filament Fabrication) аналогичная технология трехмерной FDM печати, при которой построение объекта идет за счет расплавления нити пластика, которая...
Openal можно ли удалить
В этой статье вы можете больше узнать о возможностях технологий, что работают с аудиоданными. В частности проведу небольшой обзор, относящейся...
Adblock detector