manoon
V2EX  ›  问与答

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

  •  
  •   manoon · Jul 5, 2013 · 2684 views
    This topic created in 4696 days ago, the information mentioned may be changed or developed.
    不说了,其实还是编码问题。。。。



    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)
    Supplement 1  ·  Jul 6, 2013
    OVER=======》我会告诉你们,>>/opt/log/logaaa.txt 跟 >/opt/log/logaaa.txt 这么神奇的区别么?(说的不是,追加或新建,说的是编码!)
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5244 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 03:56 · PVG 11:56 · LAX 20:56 · JFK 23:56
    ♥ Do have faith in what you're doing.