I'm doing an import data from a CSV file, after entering 210 lines, it returns me this error. I'm doing this from Django shell (manage.py shell)
ERROR - failed to write data to stream: <open file '<stdout>', mode 'w' at 0x104c8f150>
This is a problem with the IPython encoding that is not UTF-8. export PYTHONIOENCODING=UTF-8
will solve it.
This did the trick.
# sys.setdefaultencoding() does not exist, here!
import sys
reload(sys) # Reload does the trick!
sys.setdefaultencoding('UTF-8')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With