エラー
Pythonスクリプト
from PIL import Image img = Image.open('test.png') img.show()
エラー出力
Traceback (most recent call last):
File "pillow_test.py", line 4, in <module>
img.show()
File "/mnt/wsl/PHYSICALDRIVE1p1/mxnet1.9/lib/python3.8/site-packages/PIL/Image.py", line 2259, in show
_show(self, title=title)
File "/mnt/wsl/PHYSICALDRIVE1p1/mxnet1.9/lib/python3.8/site-packages/PIL/Image.py", line 3233, in _show
ImageShow.show(image, **options)
File "/mnt/wsl/PHYSICALDRIVE1p1/mxnet1.9/lib/python3.8/site-packages/PIL/ImageShow.py", line 55, in show
if viewer.show(image, title=title, **options):
File "/mnt/wsl/PHYSICALDRIVE1p1/mxnet1.9/lib/python3.8/site-packages/PIL/ImageShow.py", line 79, in show
return self.show_image(image, **options)
File "/mnt/wsl/PHYSICALDRIVE1p1/mxnet1.9/lib/python3.8/site-packages/PIL/ImageShow.py", line 105, in show_image
return self.show_file(self.save_image(image), **options)
File "/mnt/wsl/PHYSICALDRIVE1p1/mxnet1.9/lib/python3.8/site-packages/PIL/ImageShow.py", line 212, in show_file
subprocess.Popen(args)
File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1639, in _execute_child
self.pid = _posixsubprocess.fork_exec(
TypeError: expected str, bytes or os.PathLike object, not NoneType解決方法
Pillowのバージョアンを9.0.0にダウングレードすると問題なく動きます。環境
Windows 11 Ubuntu 20.04 on WSL2 既定のディストリビューション: Ubuntu-20.04 既定のバージョン: 2 WSL1 は、現在のマシン構成ではサポートされていません。 WSL1 を使用するには、"Linux 用 Windows サブシステム" オプション コンポーネントを有効にしてください。 WSL バージョン: 0.51.3.0 カーネル バージョン: 5.10.93.2 WSLg バージョン: 1.0.30 Windows バージョン: 10.0.22000.527 Python 3.8.10
2022年4月4日追記
Pillow 9.1.0にアップグレードするとエラーは消えました。touch-sp.hatenablog.com