question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Flake8 crashed! TypeError: unorderable types: str() > int()

See original GitHub issue
_2017-05-29_11_17_46

My linter-flake8 reports that Flake8 crashed:

main.js [sm]:201 linter-flake8:: Flake8 returned an error Traceback (most recent call last):
  File "/Users/keisuke.nakata/.pyenv/versions/3.5.1/lib/python3.5/site-packages/flake8/checker.py", line 471, in run_ast_checks
    ast = self.processor.build_ast()
  File "/Users/keisuke.nakata/.pyenv/versions/3.5.1/lib/python3.5/site-packages/flake8/processor.py", line 211, in build_ast
    return compile(''.join(self.lines), '', 'exec', PyCF_ONLY_AST)
UnicodeEncodeError: 'utf-8' codec can't encode character '\udce3' in position 250: surrogates not allowed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/keisuke.nakata/.pyenv/versions/3.5.1/bin/flake8", line 11, in <module>
    sys.exit(main())
  File "/Users/keisuke.nakata/.pyenv/versions/3.5.1/lib/python3.5/site-packages/flake8/main/cli.py", line 16, in main
    app.run(argv)
  File "/Users/keisuke.nakata/.pyenv/versions/3.5.1/lib/python3.5/site-packages/flake8/main/application.py", line 328, in run
    self._run(argv)
  File "/Users/keisuke.nakata/.pyenv/versions/3.5.1/lib/python3.5/site-packages/flake8/main/application.py", line 316, in _run
    self.run_checks()
  File "/Users/keisuke.nakata/.pyenv/versions/3.5.1/lib/python3.5/site-packages/flake8/main/application.py", line 246, in run_checks
    self.file_checker_manager.run()
  File "/Users/keisuke.nakata/.pyenv/versions/3.5.1/lib/python3.5/site-packages/flake8/checker.py", line 319, in run
    self.run_serial()
  File "/Users/keisuke.nakata/.pyenv/versions/3.5.1/lib/python3.5/site-packages/flake8/checker.py", line 303, in run_serial
    checker.run_checks()
  File "/Users/keisuke.nakata/.pyenv/versions/3.5.1/lib/python3.5/site-packages/flake8/checker.py", line 573, in run_checks
    self.run_ast_checks()
  File "/Users/keisuke.nakata/.pyenv/versions/3.5.1/lib/python3.5/site-packages/flake8/checker.py", line 474, in run_ast_checks
    row, column = self._extract_syntax_information(exception)
  File "/Users/keisuke.nakata/.pyenv/versions/3.5.1/lib/python3.5/site-packages/flake8/checker.py", line 441, in _extract_syntax_information
    if column > 0 and token and isinstance(exception, SyntaxError):
TypeError: unorderable types: str() > int()

I found that linter-flake8 crashes when a file contains non-ascii characters (in my case, Japanese ones). Executing flake8 from terminal works fine.

Thank you in advance!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
phapdvcommented, Jul 3, 2017

@keisuke-nakata maybe can help you. export to your shell.

export LANG='en_US.UTF-8'
export LC_CTYPE='UTF-8'

worked for me.

1reaction
Arcanemaguscommented, May 31, 2017

Note also that flake8 currently ignores encodings for stdin input (which is how it is called here), this is fixed in their master branch but hasn’t yet been released.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: unorderable types: str() > int() [duplicate]
This is the cause of your error, since a string and an int are not comparable for a greater than operation. To fix...
Read more >
Changelog — Python 3.11.1 documentation
gh-96046: PyType_Ready() now initializes ht_cached_keys and performs additional checks to ensure that type objects are properly configured. This avoids crashes ...
Read more >
TypeError: unorderable types: str() > int() please help in ...
TypeError : unorderable types: str() > int() please help in explaining this error · + 2. You must convert the input from a...
Read more >
[Example code]-Python 3.6 urllib why line starts with b
I know this question has been answered over a year ago, I found a simple. I simply added a decode() to my line...
Read more >
atomで、パッケージlinter-flake8をインストールした状態で ...
Flake8 crashed ! linter-flake8:: Flake8 threw an error related to: TypeError: unorderable types: str() > int() Please check Atom's Console ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found