Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

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

L
Lexyo (800 points)
1 2 5
in News by (800 points)
closed by

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>




382 views
closed with the note: Solved

1 Answer

andrea.sterbini (207940 points)
756 1270 2377
by (208k points)
This method displays a matrix of triples.

First load the image

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