V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
manoon
V2EX  ›  问与答

遇到一个很蛋疼的问题,脚本运行正常,但是只要想记录脚本运行的日志就会报错。

  •  
  •   manoon · 2013-07-05 23:41:56 +08:00 · 2248 次点击
    这是一个创建于 3952 天前的主题,其中的信息可能已经有所发展或是发生改变。
    不说了,其实还是编码问题。。。。



    picPath=mkdirP(unicode(updates[i].text)[:10],unicode(titles[i].text),blogDir)
    File "/opt/bin/getImg.py", line 45, in mkdirP
    if(not(os.path.isdir(newPwd))):
    File "/usr/local/lib/python2.7/genericpath.py", line 41, in isdir
    st = os.stat(s)
    UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in position 75: ordinal not in range(128)
    第 1 条附言  ·  2013-07-06 13:41:06 +08:00
    OVER=======》我会告诉你们,>>/opt/log/logaaa.txt 跟 >/opt/log/logaaa.txt 这么神奇的区别么?(说的不是,追加或新建,说的是编码!)
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1001 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 23:15 · PVG 07:15 · LAX 16:15 · JFK 19:15
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.