Wazzaps / fingerpaint

Draw using your laptop's touchpad
GNU General Public License v2.0
135 stars 6 forks source link

TypeError: 'int' object is not subscriptable #8

Closed biancofla closed 3 years ago

biancofla commented 3 years ago

Hi, when I try to run fingerpaint, I encounter the following issue:

Traceback (most recent call last):
  File "/home/<user>/.local/bin/fingerpaint", line 8, in <module>
    sys.exit(cli())
  File "/home/<user>/.local/lib/python3.8/site-packages/fingerpaint/fingerpaint.py", line 288, in cli
    main(args)
  File "/home/<user>/.local/lib/python3.8/site-packages/fingerpaint/fingerpaint.py", line 207, in main
    make_ui(handler_loop(), scaled, devname, args)
  File "/home/<user>/.local/lib/python3.8/site-packages/fingerpaint/fingerpaint.py", line 86, in make_ui
    image_canvas.line(
  File "/usr/lib/python3/dist-packages/PIL/ImageDraw.py", line 161, in line
    angles = [
  File "/usr/lib/python3/dist-packages/PIL/ImageDraw.py", line 162, in <listcomp>
    math.degrees(math.atan2(end[0] - start[0], start[1] - end[1]))
TypeError: 'int' object is not subscriptable

Touchpad used is SYNA2393:00 06CB:7A13, OS is Ubuntu 20.04 with GNOME 3.36.8.

Wazzaps commented 3 years ago

Hmm, I can't seem to reproduce this or find the cause, could you place these lines in fingerpaint.py at line 86:

                    print('-------')
                    print((int(projected_start[0] * aa_factor), int(projected_start[1] * aa_factor),
                         int(projected_end[0] * aa_factor), int(projected_end[1] * aa_factor)))
                    print('width=', int(args.line_thickness * aa_factor))

It should be right before the call to image_canvas.line. Post the output here and I'll try to solve it :)

Wazzaps commented 3 years ago

Also:

biancofla commented 3 years ago

The complete output of the command fingerpaint -o hello.png is the following:

Using touchpad: SYNA2393:00 06CB:7A13 Touchpad
-------
(2853, 1562, 2853, 1562)
width= 48
Traceback (most recent call last):
  File "/home/<user>/.local/bin/fingerpaint", line 8, in <module>
    sys.exit(cli())
  File "/home/<user>/.local/lib/python3.8/site-packages/fingerpaint/fingerpaint.py", line 292, in cli
    main(args)
  File "/home/<user>/.local/lib/python3.8/site-packages/fingerpaint/fingerpaint.py", line 211, in main
    make_ui(handler_loop(), scaled, devname, args)
  File "/home/<user>/.local/lib/python3.8/site-packages/fingerpaint/fingerpaint.py", line 90, in make_ui
    image_canvas.line(
  File "/usr/lib/<user>/dist-packages/PIL/ImageDraw.py", line 161, in line
    angles = [
  File "/usr/lib/python3/dist-packages/PIL/ImageDraw.py", line 162, in <listcomp>
    math.degrees(math.atan2(end[0] - start[0], start[1] - end[1]))
TypeError: 'int' object is not subscriptable

OS is Ubuntu 20.04 with GNOME 3.36.8.

Wazzaps commented 3 years ago

Found the problem, the version of pillow that comes with ubuntu is old and uses a different signature for ImageDraw.line. I'll fix it on my side, 1 sec.

Thanks for the report :D

Wazzaps commented 3 years ago

Fixed in #10 (link to release) :D