How to fix images.visd() : [ ValueError: invalid literal for int() with base 10: 'a' ]

L
Lexyo (800 points)
1 2 5
asked Nov 19, 2021 in News by Lexyo (800 points)
closed Nov 22, 2021 by Lexyo

I downloaded the library from the teaching materials, when trying to use the function into the spyder console it shows this error:

images.visd('cane.png')
Traceback (most recent call last):

  File "C:\Users\User\anaconda3\lib\site-packages\IPython\core\formatters.py", line 345, in __call__
    return method()

  File "C:\Users\User\OneDrive\Python\HW5opt\images.py", line 42, in _repr_png_
    img.save(b)

  File "C:\Users\User\OneDrive\Python\HW5opt\png.py", line 1280, in save
    w.write(file, self.rows)

  File "C:\Users\User\OneDrive\Python\HW5opt\png.py", line 621, in write
    nrows = self.write_passes(outfile, rows)

  File "C:\Users\User\OneDrive\Python\HW5opt\png.py", line 779, in write_passes
    extend(row)

  File "C:\Users\User\OneDrive\Python\HW5opt\png.py", line 767, in <lambda>
    return lambda sl: f([int(x) for x in sl])

  File "C:\Users\User\OneDrive\Python\HW5opt\png.py", line 767, in <listcomp>
    return lambda sl: f([int(x) for x in sl])

ValueError: invalid literal for int() with base 10: 'a'

<images.Image at 0x190cfb87af0>




151 views
closed with note: Solved

1 Answer

andrea.sterbini (172680 points)
511 927 1776
answered Nov 19, 2021 by andrea.sterbini (172,680 points)
This method displays a matrix of triples.

First load the image

Then use visd
L
Lexyo (800 points)
1 2 5
commented Nov 19, 2021 by Lexyo (800 points)
Okay so I should put as argument the actual image matrix, thanks, now it's working