Hi Ruslan,

I tried adding:

 export LC_ALL="en_US.utf8"

To my zeppelin-env.sh script and restarted Zeppelin, but I still have the
same problem.  The print statement:

python -c "print (u'\xf1')"

works from the note.  I think the problem is the use of the str function.
Looking at the stack you can see that the zeppelin code is calling
body_buf.write(str(cell)).  If you call str(u'\xf1') you will get the error.

--Ben

On Tue, Jul 11, 2017 at 10:19 AM, Ruslan Dautkhanov <dautkha...@gmail.com>
wrote:

> $ env | grep LC
>> $
>> $ python -c "print (u'\xf1')"
>> ñ
>>
>
>
>> $ export LC_ALL="C"
>> $ python -c "print (u'\xf1')"
>> Traceback (most recent call last):
>>   File "<string>", line 1, in <module>
>> UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in
>> position 0: ordinal not in range(128)
>>
>
>
>> $ export LC_ALL="en_US.utf8"
>> $ python -c "print (u'\xf1')"
>> ñ
>>
>
>
>> $ unset LC_ALL
>> $ env | grep LC
>> $
>> $ python -c "print (u'El Ni\xf1o')"
>> El Niño
>
>
> You could add LC_ALL export to your zeppelin-env.sh script.
>
>
>
> --
> Ruslan Dautkhanov
>
> On Tue, Jul 11, 2017 at 9:35 AM, Ben Vogan <b...@shopkick.com> wrote:
>
>> Hi all,
>>
>> I am trying to use the zeppelin context to show the contents of a pandas
>> DataFrame and getting the following error:
>>
>> Traceback (most recent call last):
>>   File "/tmp/zeppelin_python-7554503996532642522.py", line 278, in
>> <module>
>>     raise Exception(traceback.format_exc())
>> Exception: Traceback (most recent call last):
>>   File "/tmp/zeppelin_python-7554503996532642522.py", line 271, in
>> <module>
>>     exec(code)
>>   File "<stdin>", line 2, in <module>
>>   File "/tmp/zeppelin_python-7554503996532642522.py", line 93, in show
>>     self.show_dataframe(p, **kwargs)
>>   File "/tmp/zeppelin_python-7554503996532642522.py", line 121, in
>> show_dataframe
>>     body_buf.write(str(cell))
>> UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in
>> position 79: ordinal not in range(128)
>>
>> How do I go about resolving this?
>>
>> I'm running version 0.7.1 with python 2.7.
>>
>> Thanks,
>>
>> --
>> *BENJAMIN VOGAN* | Data Platform Team Lead
>>
>> <http://www.shopkick.com/>
>> <https://www.facebook.com/shopkick> <https://www.instagram.com/shopkick/>
>> <https://www.pinterest.com/shopkick/> <https://twitter.com/shopkickbiz>
>> <https://www.linkedin.com/company-beta/831240/?pathWildcard=831240>
>>
>
>


-- 
*BENJAMIN VOGAN* | Data Platform Team Lead

<http://www.shopkick.com/>
<https://www.facebook.com/shopkick> <https://www.instagram.com/shopkick/>
<https://www.pinterest.com/shopkick/> <https://twitter.com/shopkickbiz>
<https://www.linkedin.com/company-beta/831240/?pathWildcard=831240>

Reply via email to