2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Python 3.9 で pylint を使用すると typing で誤ったエラーが表示される

Posted at

環境

  • Python 3.9.0
  • pylint 2.6.0(2020/12/13 時点で最新)

問題

pylint を実行したときに、typing モジュールの使用箇所に誤ったエラーが表示される。

例:

$ pylint module
************* Module module
module.py:213:35: E1136: Value 'Union' is unsubscriptable (unsubscriptable-object)

typing.Uniontyping.Union[int,str] のように型を示すために使うもので、これが unsubscriptable というのは明らかな誤りです。

対処法

Python のバージョンを 3.8.6 まで下げたら直りました。

なお、GitHub 上の Pull Request を見る限り、pylint の Git リポジトリ上の master ブランチでは直っているようです。(pylint の最新リリースの後に修正された模様。)どうしても Python 3.9 で使いたい方は、Git リポジトリからインストールすることでも直せるかもしれません。

感想

Python は最新リリースの手前くらいのマイナーバージョンの方が、パッケージまで安定していて良いと思いました。

2
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?