On Wednesday, June 13, 2018 at 6:50:44 PM UTC-7, lucas wrote:
>
> so, i've figured out that the entire blob stream is not being fully
> retrieved, only 29 of the 5513 bytes are being retrieved:
>
> in my debugging: here is an experimental / expanded of the above
> function:::
> table, id, field, stream, and d are all working. but the d[field] under
> stream.write(d[field]) seems to only retrieve 29 bytes of the 5513 total
> bytes, as verified by the binary file write i have below.
>
> def getbinary():
> table = db[request.args[0]]
> id = int(request.args[1])
> field = table[request.args[2]]
> try:
> stream = StringIO()
> d = db(table.id==id).select(field).first()
> stream.write(d[field])
> except:
> return CAT('exception getbinary():', BR(), 'table:', table,
> type(table), BR(), 'id:', id, type(id), BR(), 'field:', field, type(field))
> #data = base64.b64decode(data)
> #data = data.decode('base64')
> f = open('/opt/web-apps/web2py/applications/tms/out1.png', 'wb')
> f.write(stream.getvalue())
> f.close()
> return CAT(type(stream), BR(), stream)
> response.headers['Content-Type'] = 'image/png'
> return response.write(data, escape=False)
>
>
I have no concrete suggestions, but which DB back end are you using?
Handling blob fields are, AIUI, one of the ways they differ.
I have this silly thought that it's something like the string "truncation"
you get when UTF-16 is viewed as a string.
/dps
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.