Jun-17-2018, 12:37 PM
(Jun-17-2018, 09:37 AM)diet Wrote: Hi,One thing that is dangerous in your code - you override (shadow) global name
I am new to Python and Jupyter Notebook and I get the error below in Jupyter Notebook while the code works in Spyder:
import base64 import json import subprocess def output_image(name, format, bytes): image_start = "BEGIN_IMAGE_f9825uweof8jw9fj4r8" image_end = "END_IMAGE_0238jfw08fjsiufhw8frs" data = {} data['name'] = name data['format'] = format data['bytes'] = base64.encodestring(bytes) print(image_start + json.dumps(data) + image_end)
format
. Maybe that is not your issue - but it is a potentially dangerous substitution
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.