SQLite Forum

How to read Images from sqlite3 and show via opencv, PIL or Matplot lib ?
The error messages are perfectly explicit about the error **YOU** are committing.

In the first case "Can't convert object of type 'bytes' to 'str' for 'filename'" is saying that the parameter you passed which is supposed to contain the 'filename' in text (unicode string) does contain data in the format required.  The parameter you passed has type 'bytes' and it must be type 'str', and the 'bytes' that you provided cannot be 'magically converted' into a valid 'str'.

In the second case, "ValueError: embedded null byte", means that you passed an argument which must be a string 'str' and therefore cannot contain a null byte (0).  However the value you passed was not a valid 'str' because it contained a null (0) byte.

THe likely cause is that the API you are calling requires you to present to it "Purple Giraffes" and you have instead presented "Fushia Tigers", although the internal conversion mechanism cannot convert "Fushia Tigers" into "Purple Giraffes".

THe proper course of action would be for **you** to read the documentation and find the API which accepts "Fushcia Tigers" and, if that API does what you want, then use it.  If there is no API that accepts "Fushia Tigers" and all you have are "Fushia Tigers" then you either need to figure out how to do the conversion yourself, on just give up trying and go have a nice bottle of wine.

Your presentation of an incorrect data type is not an SQLite3 issue