python3のエンコーディング問題
環境
さくらレンタルサーバー
Python 3.6.1
困っていること
いままでAnacondaに頼って来たこともあり、しばらくエンコーディング問題に直面したことがなかったので、以下のエラーがでて困っています。
スクリプト(test.py)
python
1#!/home/<user>/local/python/bin/python3 2# coding: utf-8 3from bs4 import BeautifulSoup 4import requests 5 6url = 'http://hogehoge.com' #日本語のページ 7html = requests.get(url) 8soup = BeautifulSoup(html.content,'html5lib') 9print(soup)
シェル
python3 test.py
エラー内容
python
1UnicodeEncodeError: 'ascii' codec can't encode characters in position 315-323: ordinal not in range(128)
なんとかググって解決したいのですが、どうもしっくり来る答えが見つからず、困っています。
よろしくお願いします。
追記
このtest.pyを自分のローカルPCでは問題なく実行できます。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/06/05 04:25
2017/06/05 04:52 編集
2017/06/05 05:52
2017/06/05 06:04
2017/06/07 00:09
2017/06/07 00:45