This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: AttributeError
Type: behavior Stage: resolved
Components: Documentation Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: docs@python, maakvol, matrixise, steven.daprano, vstinner, xtreak
Priority: normal Keywords:

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 "<stdin>", line 1, in <module>
  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 "<stdin>", line 1, in <module>
  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:14adminsetgithub: 80838
2019-04-18 16:00:50vstinnersetnosy: + vstinner
messages: + msg340506
2019-04-18 15:50:26steven.dapranosetnosy: + steven.daprano
messages: + msg340503
2019-04-18 15:39:00maakvolsetmessages: + msg340502
2019-04-18 15:14:52xtreaksetstatus: open -> closed
type: compile error -> behavior
messages: + msg340499

assignee: docs@python ->
resolution: not a bug
stage: resolved
2019-04-18 15:12:43matrixisesetnosy: + matrixise
messages: + msg340498
2019-04-18 14:59:22xtreaksetmessages: + msg340495
2019-04-18 14:50:15maakvolsetmessages: + msg340493
2019-04-18 14:46:00xtreaksetnosy: + xtreak
messages: + msg340491
2019-04-18 14:42:24maakvolcreate