Isort: Isort5 throws error when stdin used on Windows with deprecated args

Created on 1 Sep 2020  路  4Comments  路  Source: PyCQA/isort

Running type before.py | isort - --diff -sp .isort.cfg prints the following traceback in case deprecated args is used,

Traceback (most recent call last):
  File "C:\Users\karraj\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\karraj\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\karraj\Desktop\imports\.isort5\Scripts\isort.exe\__main__.py", line 9, in <module>
  File "c:\users\karraj\desktop\imports\.isort5\lib\site-packages\isort\main.py", line 828, in main
    api.sort_stream(
  File "c:\users\karraj\desktop\imports\.isort5\lib\site-packages\isort\api.py", line 118, in sort_stream
    changed = sort_stream(
  File "c:\users\karraj\desktop\imports\.isort5\lib\site-packages\isort\api.py", line 137, in sort_stream
    config = _config(path=file_path, config=config, **config_kwargs)
  File "c:\users\karraj\desktop\imports\.isort5\lib\site-packages\isort\api.py", line 381, in _config
    config = Config(**config_kwargs)
  File "c:\users\karraj\desktop\imports\.isort5\lib\site-packages\isort\settings.py", line 423, in __init__
    super().__init__(sources=tuple(sources), **combined_config)  # type: ignore
TypeError: __init__() got an unexpected keyword argument 'remapped_deprecated_args'

I was expecting it to print the same thing when isort --diff before.py -sp .isort.cfg is run,

--- C:\Users\karraj\Desktop\imports\before.py:before    2020-09-01 02:59:53.017777
+++ C:\Users\karraj\Desktop\imports\before.py:after     2020-09-01 04:00:37.012947
@@ -1,3 +1 @@
-from third_party import (lib1, lib2, lib3,
-                         lib4, lib5, lib6,
-                         lib7, lib8, lib9)
+from third_party import lib1, lib2, lib3, lib4, lib5, lib6, lib7, lib8, lib9
c:\users\karraj\desktop\imports\.isort5\lib\site-packages\isort\main.py:901: UserWarning: W0502: The following deprecated single dash CLI flags were used and translated: -sp!
  warn(
c:\users\karraj\desktop\imports\.isort5\lib\site-packages\isort\main.py:910: UserWarning: W0500: Please see the 5.0.0 Upgrade guide: https://timothycrosley.github.io/isort/docs/upgrade_guides/5.0.0/
  warn(

I planned to use the warning codes here but this is a blocker. cc @timothycrosley

bug integration

All 4 comments

Adding the following line here should fix the error,

remapped_deprecated_args: FrozenSet[str] = frozenset()

If you agree, will it be possible to make a release with the fix soon? I need it to show the prompt we discussed about.https://github.com/PyCQA/isort/issues/1363#issuecomment-669090762

@karrtikr, thanks for letting me know about this issue! I'll make sure to have a release out shortly (tonight or tomorrow morning) that resolves it.

~Timothy

Thanks!

This change has just been deployed to PyPI in version 5.5.0

Thanks!

~Timothy

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akaihola picture akaihola  路  3Comments

pradyunsg picture pradyunsg  路  3Comments

johnthagen picture johnthagen  路  3Comments

jedie picture jedie  路  3Comments

kevindaum picture kevindaum  路  4Comments