Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageShow.show() for DisplayViewer doesn't work if no title is given #6146

Closed
csarn opened this issue Mar 21, 2022 · 1 comment · Fixed by #6136
Closed

ImageShow.show() for DisplayViewer doesn't work if no title is given #6146

csarn opened this issue Mar 21, 2022 · 1 comment · Fixed by #6136
Labels
Bug Any unexpected behavior, until confirmed feature.

Comments

@csarn
Copy link

csarn commented Mar 21, 2022

To reproduce the bug, just run ".show()" on any image object, while only having imagemagick's display viewer on the PATH.

from PIL import Image
Image.new('RGB', (10, 10)).show()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.10/site-packages/PIL/Image.py", line 2259, in show
    _show(self, title=title)
  File "/usr/lib/python3.10/site-packages/PIL/Image.py", line 3233, in _show
    ImageShow.show(image, **options)
  File "/usr/lib/python3.10/site-packages/PIL/ImageShow.py", line 55, in show
    if viewer.show(image, title=title, **options):
  File "/usr/lib/python3.10/site-packages/PIL/ImageShow.py", line 79, in show
    return self.show_image(image, **options)
  File "/usr/lib/python3.10/site-packages/PIL/ImageShow.py", line 105, in show_image
    return self.show_file(self.save_image(image), **options)
  File "/usr/lib/python3.10/site-packages/PIL/ImageShow.py", line 212, in show_file
    subprocess.Popen(args)
  File "/usr/lib/python3.10/subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1775, in _execute_child
    self.pid = _posixsubprocess.fork_exec(
TypeError: expected str, bytes or os.PathLike object, not NoneType

The reason is that the DisplayViewer class just appends options["title"] to the argument list:

args += ["-title", options["title"]]

But the default value for title is None:
def show(image, title=None, **options):

@radarhere radarhere added the Bug Any unexpected behavior, until confirmed feature. label Mar 21, 2022
@radarhere
Copy link
Member

PR #6136 resolves this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Any unexpected behavior, until confirmed feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants