Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3 AttributeError: 'str' object has no attribute 'decode' #32

Open
fengor opened this issue Dec 13, 2017 · 0 comments · May be fixed by #33
Open

python3 AttributeError: 'str' object has no attribute 'decode' #32

fengor opened this issue Dec 13, 2017 · 0 comments · May be fixed by #33

Comments

@fengor
Copy link

fengor commented Dec 13, 2017

Running ti inside GIT Bash with python 3.5.2 raises the above mentioned error. Apparently the str object has no decode function since it is already considered decoded

`brac010@ISS16661 MINGW64 /h/timekeeping
$ python --version
Python 3.5.2

brac010@ISS16661 MINGW64 /h/timekeeping
$ ti -h
Traceback (most recent call last):
File "H:/timekeeping/ti", line 434, in
main()
File "H:/timekeeping/ti", line 425, in main
fn, args = parse_args()
File "H:/timekeeping/ti", line 352, in parse_args
argv = [arg.decode('utf-8') for arg in argv]
File "H:/timekeeping/ti", line 352, in
argv = [arg.decode('utf-8') for arg in argv]
AttributeError: 'str' object has no attribute 'decode'

brac010@ISS16661 MINGW64 /h/timekeeping
$
`

fengor added a commit to fengor/ti that referenced this issue Dec 13, 2017
the elements of argv are already str objects which are already considered decoded by python 3.5.2. This commit adds a try-except block for the AttributeError that is raised. This should keep the decoding intact for python2 while silently dropping the error in python3

fixes sharat87#32
@fengor fengor linked a pull request Dec 13, 2017 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant