Open hupili opened 11 years ago
Not sure whether the following line works:
- logger.warning(response["error_msg"])
+ logger.warning("%s", response["error_msg"])
Tried to fix the following, in https://github.com/hupili/snsapi/commit/24c478ae1da69c398b07cb0619826c46071ed697
$grep -onRP "logger.(debug|info|warning)\([^\'\"].+\)" .
./snspocket.py:102:logger.debug(json.dumps(jsonconf))
./plugin/renren.py:171:logger.warning(response["error_msg"])
./plugin/renren.py:196:logger.warning(response["error_msg"])
./plugin/renren.py:369:logger.debug(json.dumps(dct))
./plugin_trial/facebook.py:30:logger.debug(str(dct))
./plugin_trial/sina_wap.py:177:logger.warning(err_msg)
This error is obscure. We need more investigation. It seems like logging facilities can not handle non-ascii chars in the format string under some environment.
More info.
This is related with encoding of unicode characters.
Similar problem is observed at other places and some folks solve it by:
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
There are also many reasons not to do this.