Issue 36657: AttributeError - Python tracker (original) (raw)

Created on 2019-04-18 14:42 by maakvol, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (9)
msg340490 - (view) Author: maak (maakvol) Date: 2019-04-18 14:42
elif path == '' or path.endswith('/'): AttributeError: 'bool' object has no attribute 'endswith'
msg340491 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-04-18 14:46
Please add a short script and explain the problem over why it's a bug in CPython and not a problem with the program. The error says path has a boolean value and doesn't have endswith which is a method on string object.
msg340493 - (view) Author: maak (maakvol) Date: 2019-04-18 14:50
File "/home/maak/PycharmProjects/Fyp/venv/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "main.py", line 132, in main bestmodel_dir = os.path.join(FLAGS.train_dir, "best_checkpoint") File "/home/maak/PycharmProjects/Fyp/venv/lib/python2.7/posixpath.py", line 70, in join elif path == '' or path.endswith('/'): AttributeError: 'bool' object has no attribute 'endswith'
msg340495 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-04-18 14:59
Please check the value of FLAGS.train_dir which I guess has a boolean value. This is not a bug with CPython. $ python2 Python 2.7.14 (default, Mar 12 2018, 13:54:56) [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> os.path.join(True, 'best_checkpoint') Traceback (most recent call last): File "", line 1, in File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 70, in join elif path == '' or path.endswith('/'): AttributeError: 'bool' object has no attribute 'endswith'
msg340498 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-04-18 15:12
Hi Karthikeyan, I think we could close this issue, it's not related to CPython itself. What do you think?
msg340499 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-04-18 15:14
> I think we could close this issue, it's not related to CPython itself. Closing it. OP can reopen if needed. Thanks.
msg340502 - (view) Author: maak (maakvol) Date: 2019-04-18 15:39
FLAGS.train_dir has a boolean value which is checking true or false and i also have same issue import os >>> os.path.join(True, 'best_checkpoint') Traceback (most recent call last): File "", line 1, in File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 70, in join elif path == '' or path.endswith('/'): AttributeError: 'bool' object has no attribute 'endswith' can you give me a solution or idea how to solve issue
msg340503 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2019-04-18 15:50
Hi Maakvol, Please remember that this is a bug tracker for bugs in the Python language and standard library, not a help desk. As a beginner, 99.9% of the times you think that you have found a bug in Python, you haven't, it will be a bug in your own code. There are many forums where you can ask for help with your code, such as the tutor mailing list https://mail.python.org/mailman/listinfo/tutor Stackoverflow, Reddit's /r/learnpython, and more. You should check with other, more experienced programmers before reporting things as bugs. Thank you.
msg340506 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-04-18 16:00
... maak opened a second issue... bpo-36660.
History
Date User Action Args
2022-04-11 14:59:14 admin set github: 80838
2019-04-18 16:00:50 vstinner set nosy: + vstinnermessages: +
2019-04-18 15:50:26 steven.daprano set nosy: + steven.dapranomessages: +
2019-04-18 15:39:00 maakvol set messages: +
2019-04-18 15:14:52 xtreak set status: open -> closedtype: compile error -> behaviormessages: + assignee: docs@python -> resolution: not a bugstage: resolved
2019-04-18 15:12:43 matrixise set nosy: + matrixisemessages: +
2019-04-18 14:59:22 xtreak set messages: +
2019-04-18 14:50:15 maakvol set messages: +
2019-04-18 14:46:00 xtreak set nosy: + xtreakmessages: +
2019-04-18 14:42:24 maakvol create