Skip to content
This repository has been archived by the owner on Jul 20, 2019. It is now read-only.

Undefined name 'status' in sttClient.py #27

Closed
cclauss opened this issue Nov 5, 2018 · 2 comments
Closed

Undefined name 'status' in sttClient.py #27

cclauss opened this issue Nov 5, 2018 · 2 comments

Comments

@cclauss
Copy link

cclauss commented Nov 5, 2018

Should this be value['status'] instead?

flake8 testing of https://github.com/watson-developer-cloud/speech-to-text-websockets-python on Python 3.7.1

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./sttClient.py:401:37: F821 undefined name 'status'
            print(fmt.format(key, **status))
                                    ^
1     F821 undefined name 'status'
1
@daniel-bolanos
Copy link

hi @cclauss I'm not sure this tool is meant to work on python 3.7.1. When I originally wrote it I targeted python 2.7.

@cclauss
Copy link
Author

cclauss commented Nov 6, 2018

flake8 returns the same result when run on Python 2.7. In a compiled language this issue would be caught by the compiler at compile time but more dynamic languages like Python have fewer checks so linting with tools like flake8 is more important. Look at the code and think like a compiler. Try to determine what is the value of status just before this line is run. I believe that you will discover that status was never defined.

cclauss pushed a commit to cclauss/speech-to-text-websockets-python that referenced this issue Nov 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants