TypeError: unsupported operand type(s) for +: ‘PosixPath’ and ‘str’

If you look through your type error, it’s actually because you’re trying to use the + operator on a PosixPath type and a str. You’ll need to convert the PosixPath to a string before you can use the imwrite.

Maybe try:

cv2.imwrite(str(path) + "https://stackoverflow.com/" + "photo.png", img)

Alternatively, use the proper concatenation as described in the pathlib docs.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)