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

Hacktoberfest: Python 3 compatibility issues #55

Open
cclauss opened this issue Oct 3, 2019 · 2 comments
Open

Hacktoberfest: Python 3 compatibility issues #55

cclauss opened this issue Oct 3, 2019 · 2 comments

Comments

@cclauss
Copy link

cclauss commented Oct 3, 2019

flake8 testing of https://github.com/ArduPilot/SiK on Python 3.7.1

$ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics

./Firmware/tools/check_code.py:17:13: E999 SyntaxError: invalid syntax
    print sys.argv
            ^
./Firmware/tools/bank-alloc.py:143:31: E999 SyntaxError: invalid syntax
					print "Failed to allocate", module[0], "with size", module[1], \
                              ^
./Firmware/tools/update_mode.py:35:12: F821 undefined name 'pexpect'
    except pexpect.TIMEOUT:
           ^
./Firmware/tools/atcommander.py:269:81: E999 SyntaxError: invalid syntax
        print "Please specify a --list-* or --set-* operation (try -h if unsure)"
                                                                                ^
./Firmware/tools/rssi.py:51:31: E999 TabError: inconsistent use of tabs and spaces in indentation
            	sys.stdout.flush()
                              ^
./Firmware/tools/uploader.py:100:31: E999 TabError: inconsistent use of tabs and spaces in indentation
                if use_mavlink:
                              ^
5     E999 SyntaxError: invalid syntax
1     F821 undefined name 'pexpect'
6

E901,E999,F821,F822,F823 are the "showstopper" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. These 5 are different from most other flake8 issues which are merely "style violations" -- useful for readability but they do not effect runtime safety.

  • F821: undefined name name
  • F822: undefined name name in __all__
  • F823: local variable name referenced before assignment
  • E901: SyntaxError or IndentationError
  • E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree
@monkeypants
Copy link

The quickest way to fix this would be to state in the README that python 3 is not yet supported.

Are these 6 things the only changes needed for python3 support?

@cclauss
Copy link
Author

cclauss commented Oct 10, 2019

83 days until Python 2 end of life. These changes are necessary but probably not sufficient for a complete port to Python 3. It is not best practice to port to Python 3 in a single pull request unless the codebase is trivially small.

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

No branches or pull requests

2 participants