maoschanz / drawing

Simple image editor for Linux
https://maoschanz.github.io/drawing/
GNU General Public License v3.0
784 stars 101 forks source link

Bad parsing of Command Line arguments #626

Closed liar666 closed 10 months ago

liar666 commented 11 months ago

Description

Using: Drawing 0.8.5

If I call /usr/bin/drawing from CLI with an image as an argument , it wrongly takes the argument 0 (name of command) as the first image to open...

Steps to reproduce the bug

user$ /usr/bin/drawing tmp/screenshot_2023-12-07-10.44.png 
Error opening this file. /usr/bin/drawing isn't an image.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/drawing/window.py", line 156, in init_window_content_async
    self.build_new_image()
  File "/usr/lib/python3/dist-packages/drawing/window.py", line 302, in build_new_image
    self.set_picture_title()
  File "/usr/lib/python3/dist-packages/drawing/window.py", line 641, in set_picture_title
    subtitle = self.active_tool().get_edition_status()
  File "/usr/lib/python3/dist-packages/drawing/tool_text.py", line 87, in get_edition_status
    bg_label = {
KeyError: 'outline'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/drawing/main.py", line 197, in on_cli
    self.open_window_with_content(f, False)
  File "/usr/lib/python3/dist-packages/drawing/main.py", line 119, in open_window_with_content
    win.init_window_content_async(content_params)
  File "/usr/lib/python3/dist-packages/drawing/window.py", line 158, in init_window_content_async
    self.prompt_message(True, excp.message)
AttributeError: 'KeyError' object has no attribute 'message'

System

maoschanz commented 10 months ago

this was fixed by this commit https://github.com/maoschanz/drawing/commit/d6850b431e33a6c2fee4a97a964ec642ece27536 which has been released in version 1.0.1 (april 2022)