Closed librehat closed 3 years ago
An addition to help debugging maybe: this failure happens on Debian Linux as well (Docker Python-3.8:slim
image)
@librehat are you able to share your config file? IE by running isort . --show-config
For reference, the error traceback makes me thing that you likely have an sections list without LOCALFOLDER
in it, and something is recognized as being part of a local folder
@timothycrosley sure, the config is
{
"_known_patterns": null,
"_section_comments": null,
"py_version": "py3",
"force_to_top": [],
"skip": [
".hg",
".git",
".eggs",
".nox",
"buck-out",
".direnv",
".svn",
"dist",
".pants.d",
".tox",
"_build",
".bzr",
".venv",
"build",
"venv",
"node_modules",
".mypy_cache"
],
"skip_glob": [],
"skip_gitignore": false,
"line_length": 95,
"wrap_length": 0,
"line_ending": "",
"sections": [
"STDLIB",
"THIRDPARTY",
"FIRSTPARTY",
"TESTS"
],
"no_sections": false,
"known_future_library": [
"__future__"
],
"known_third_party": [],
"known_first_party": [],
"known_local_folder": [],
"known_standard_library": [
"pickle",
"html",
"webbrowser",
"http",
"symtable",
"turtledemo",
"token",
"resource",
"pty",
"uu",
"binascii",
"winsound",
"logging",
"threading",
"copy",
"graphlib",
"calendar",
"getopt",
"marshal",
"symbol",
"msilib",
"datetime",
"pdb",
"xdrlib",
"enum",
"hmac",
"rlcompleter",
"queue",
"textwrap",
"pipes",
"gettext",
"plistlib",
"bisect",
"readline",
"poplib",
"inspect",
"tracemalloc",
"tarfile",
"string",
"pprint",
"functools",
"abc",
"dis",
"weakref",
"faulthandler",
"locale",
"linecache",
"unicodedata",
"sunau",
"winreg",
"tabnanny",
"pwd",
"imaplib",
"select",
"asynchat",
"glob",
"lib2to3",
"configparser",
"concurrent",
"sre_constants",
"zipimport",
"wave",
"codeop",
"math",
"syslog",
"tkinter",
"ftplib",
"_dummy_thread",
"wsgiref",
"fractions",
"ossaudiodev",
"venv",
"site",
"bz2",
"distutils",
"aifc",
"cmath",
"asyncio",
"sre_parse",
"sqlite3",
"base64",
"ast",
"pickletools",
"chunk",
"selectors",
"cgitb",
"mailcap",
"contextvars",
"zipfile",
"imp",
"reprlib",
"crypt",
"sysconfig",
"builtins",
"email",
"tty",
"colorsys",
"os",
"gc",
"binhex",
"atexit",
"spwd",
"modulefinder",
"codecs",
"nntplib",
"parser",
"encodings",
"asyncore",
"socket",
"shlex",
"cmd",
"decimal",
"grp",
"subprocess",
"array",
"cProfile",
"getpass",
"sre_compile",
"formatter",
"compileall",
"imghdr",
"termios",
"posix",
"telnetlib",
"smtplib",
"secrets",
"stat",
"filecmp",
"fileinput",
"trace",
"code",
"pkgutil",
"fnmatch",
"xml",
"ipaddress",
"random",
"pathlib",
"sndhdr",
"fpectl",
"operator",
"collections",
"typing",
"xmlrpc",
"stringprep",
"doctest",
"argparse",
"socketserver",
"bdb",
"copyreg",
"zoneinfo",
"_thread",
"errno",
"macpath",
"json",
"smtpd",
"numbers",
"zipapp",
"ensurepip",
"multiprocessing",
"profile",
"py_compile",
"sched",
"re",
"types",
"signal",
"ctypes",
"optparse",
"difflib",
"heapq",
"itertools",
"platform",
"sre",
"cgi",
"lzma",
"fcntl",
"pydoc",
"quopri",
"turtle",
"contextlib",
"mailbox",
"nis",
"tokenize",
"mimetypes",
"gzip",
"shutil",
"test",
"hashlib",
"timeit",
"time",
"shelve",
"pyclbr",
"dataclasses",
"tempfile",
"netrc",
"posixpath",
"uuid",
"zlib",
"pstats",
"ssl",
"dbm",
"sys",
"traceback",
"msvcrt",
"statistics",
"audioop",
"urllib",
"ntpath",
"csv",
"io",
"unittest",
"mmap",
"keyword",
"struct",
"runpy",
"warnings",
"importlib",
"dummy_threading",
"curses"
],
"extra_standard_library": [],
"known_other": {
"tests": [
"tests"
]
},
"multi_line_output": "VERTICAL_HANGING_INDENT",
"forced_separate": [],
"indent": " ",
"comment_prefix": " #",
"length_sort": false,
"length_sort_straight": false,
"length_sort_sections": [],
"add_imports": [],
"remove_imports": [],
"append_only": false,
"reverse_relative": false,
"force_single_line": false,
"single_line_exclusions": [],
"default_section": "THIRDPARTY",
"import_headings": {},
"balanced_wrapping": false,
"use_parentheses": false,
"order_by_type": true,
"atomic": false,
"lines_after_imports": -1,
"lines_between_sections": 1,
"lines_between_types": 0,
"combine_as_imports": false,
"combine_star": false,
"include_trailing_comma": true,
"from_first": false,
"verbose": false,
"quiet": false,
"force_adds": false,
"force_alphabetical_sort_within_sections": false,
"force_alphabetical_sort": false,
"force_grid_wrap": 0,
"force_sort_within_sections": false,
"lexicographical": false,
"group_by_package": false,
"ignore_whitespace": false,
"no_lines_before": [],
"no_inline_sort": false,
"ignore_comments": false,
"case_sensitive": false,
"sources": [
{
"py_version": "py3",
"force_to_top": [],
"skip": [
".hg",
".git",
".eggs",
".nox",
"buck-out",
".direnv",
".svn",
"dist",
".pants.d",
".tox",
"_build",
".bzr",
".venv",
"build",
"venv",
"node_modules",
".mypy_cache"
],
"skip_glob": [],
"skip_gitignore": false,
"line_length": 79,
"wrap_length": 0,
"line_ending": "",
"sections": [
"FUTURE",
"STDLIB",
"THIRDPARTY",
"FIRSTPARTY",
"LOCALFOLDER"
],
"no_sections": false,
"known_future_library": [
"__future__"
],
"known_third_party": [],
"known_first_party": [],
"known_local_folder": [],
"known_standard_library": [
"pickle",
"html",
"webbrowser",
"http",
"symtable",
"turtledemo",
"token",
"resource",
"pty",
"uu",
"binascii",
"winsound",
"logging",
"threading",
"copy",
"graphlib",
"calendar",
"getopt",
"marshal",
"symbol",
"msilib",
"datetime",
"pdb",
"xdrlib",
"enum",
"hmac",
"rlcompleter",
"queue",
"textwrap",
"pipes",
"gettext",
"plistlib",
"bisect",
"readline",
"poplib",
"inspect",
"tracemalloc",
"tarfile",
"string",
"pprint",
"functools",
"abc",
"dis",
"weakref",
"faulthandler",
"locale",
"linecache",
"unicodedata",
"sunau",
"winreg",
"tabnanny",
"pwd",
"imaplib",
"select",
"asynchat",
"glob",
"lib2to3",
"configparser",
"concurrent",
"sre_constants",
"zipimport",
"wave",
"codeop",
"math",
"syslog",
"tkinter",
"ftplib",
"_dummy_thread",
"wsgiref",
"fractions",
"ossaudiodev",
"venv",
"site",
"bz2",
"distutils",
"aifc",
"cmath",
"asyncio",
"sre_parse",
"sqlite3",
"base64",
"ast",
"pickletools",
"chunk",
"selectors",
"cgitb",
"mailcap",
"contextvars",
"zipfile",
"imp",
"reprlib",
"crypt",
"sysconfig",
"builtins",
"email",
"tty",
"colorsys",
"os",
"gc",
"binhex",
"atexit",
"spwd",
"modulefinder",
"codecs",
"nntplib",
"parser",
"encodings",
"asyncore",
"socket",
"shlex",
"cmd",
"decimal",
"grp",
"subprocess",
"array",
"cProfile",
"getpass",
"sre_compile",
"formatter",
"compileall",
"imghdr",
"termios",
"posix",
"telnetlib",
"smtplib",
"secrets",
"stat",
"filecmp",
"fileinput",
"trace",
"code",
"pkgutil",
"fnmatch",
"xml",
"ipaddress",
"random",
"pathlib",
"sndhdr",
"fpectl",
"operator",
"collections",
"typing",
"xmlrpc",
"stringprep",
"doctest",
"argparse",
"socketserver",
"bdb",
"copyreg",
"zoneinfo",
"_thread",
"errno",
"macpath",
"json",
"smtpd",
"numbers",
"zipapp",
"ensurepip",
"multiprocessing",
"profile",
"py_compile",
"sched",
"re",
"types",
"signal",
"ctypes",
"optparse",
"difflib",
"heapq",
"itertools",
"platform",
"sre",
"cgi",
"lzma",
"fcntl",
"pydoc",
"quopri",
"turtle",
"contextlib",
"mailbox",
"nis",
"tokenize",
"mimetypes",
"gzip",
"shutil",
"test",
"hashlib",
"timeit",
"time",
"shelve",
"pyclbr",
"dataclasses",
"tempfile",
"netrc",
"posixpath",
"uuid",
"zlib",
"pstats",
"ssl",
"dbm",
"sys",
"traceback",
"msvcrt",
"statistics",
"audioop",
"urllib",
"ntpath",
"csv",
"io",
"unittest",
"mmap",
"keyword",
"struct",
"runpy",
"warnings",
"importlib",
"dummy_threading",
"curses"
],
"extra_standard_library": [],
"known_other": {},
"multi_line_output": "GRID",
"forced_separate": [],
"indent": " ",
"comment_prefix": " #",
"length_sort": false,
"length_sort_straight": false,
"length_sort_sections": [],
"add_imports": [],
"remove_imports": [],
"append_only": false,
"reverse_relative": false,
"force_single_line": false,
"single_line_exclusions": [],
"default_section": "THIRDPARTY",
"import_headings": {},
"balanced_wrapping": false,
"use_parentheses": false,
"order_by_type": true,
"atomic": false,
"lines_after_imports": -1,
"lines_between_sections": 1,
"lines_between_types": 0,
"combine_as_imports": false,
"combine_star": false,
"include_trailing_comma": false,
"from_first": false,
"verbose": false,
"quiet": false,
"force_adds": false,
"force_alphabetical_sort_within_sections": false,
"force_alphabetical_sort": false,
"force_grid_wrap": 0,
"force_sort_within_sections": false,
"lexicographical": false,
"group_by_package": false,
"ignore_whitespace": false,
"no_lines_before": [],
"no_inline_sort": false,
"ignore_comments": false,
"case_sensitive": false,
"sources": [],
"virtual_env": "",
"conda_env": "",
"ensure_newline_before_comments": false,
"directory": "",
"profile": "",
"honor_noqa": false,
"src_paths": [],
"old_finders": false,
"remove_redundant_aliases": false,
"float_to_top": false,
"filter_files": false,
"formatter": "",
"formatting_function": null,
"color_output": false,
"treat_comments_as_code": [],
"treat_all_comments_as_code": false,
"supported_extensions": [
"py",
"pyi",
"pyx",
"pxd"
],
"blocked_extensions": [
"pex"
],
"constants": [],
"classes": [],
"variables": [],
"dedup_headings": false,
"only_sections": false,
"only_modified": false,
"combine_straight_imports": false,
"auto_identify_namespace_packages": true,
"namespace_packages": [],
"follow_links": true,
"indented_import_headings": true,
"source": "defaults"
},
{
"line_length": 95,
"multi_line_output": "VERTICAL_HANGING_INDENT",
"include_trailing_comma": true,
"known_tests": [
"tests"
],
"sections": [
"STDLIB",
"THIRDPARTY",
"FIRSTPARTY",
"TESTS"
],
"source": "/Users/<MASKED>/Projects/<MASKED>/<MASKED>/<MASKED>/pyproject.toml"
}
],
"virtual_env": "",
"conda_env": "",
"ensure_newline_before_comments": false,
"directory": "/Users/<MASKED>/Projects/<MASKED>/<MASKED>/<MASKED>",
"profile": "",
"honor_noqa": false,
"src_paths": [
"/Users/<MASKED>/Projects/<MASKED>/<MASKED>/<MASKED>/src",
"/Users/<MASKED>/Projects/<MASKED>/<MASKED>/<MASKED>"
],
"old_finders": false,
"remove_redundant_aliases": false,
"float_to_top": false,
"filter_files": false,
"formatter": "",
"formatting_function": null,
"color_output": false,
"treat_comments_as_code": [],
"treat_all_comments_as_code": false,
"supported_extensions": [
"py",
"pyi",
"pyx",
"pxd"
],
"blocked_extensions": [
"pex"
],
"constants": [],
"classes": [],
"variables": [],
"dedup_headings": false,
"only_sections": false,
"only_modified": false,
"combine_straight_imports": false,
"auto_identify_namespace_packages": true,
"namespace_packages": [],
"follow_links": true,
"indented_import_headings": true
}
@librehat,
It looks like your config is overriding sections, but missing the required LOCALFOLDER sections:
"sections": [
"STDLIB",
"THIRDPARTY",
"FIRSTPARTY",
"TESTS"
],
Could you try adding it:
"sections": [
"STDLIB",
"THIRDPARTY",
"FIRSTPARTY",
"LOCALFOLDER",
"TESTS"
],
and see if this fixes your issue?
Yes that fixes the problem! Thank you! Didn't realise it was a misconfiguration issue
I've recently upgraded my Python interpreter to 3.8.8 (macOS, installed via homebrew), and isort to
5.7.0
(from4.x
). It now crashes when checking a__init__.py
file:This
__init__.py
file's contents:I tried to downgrade
isort
back to major version 4 and that would work without a problem