SiK icon indicating copy to clipboard operation
SiK copied to clipboard

Hacktoberfest: Python 3 compatibility issues

Open cclauss opened this issue 5 years ago • 2 comments

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

cclauss avatar Oct 03 '19 09:10 cclauss

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?

monkeypants avatar Oct 09 '19 23:10 monkeypants

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.

cclauss avatar Oct 10 '19 02:10 cclauss