judger.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:JudgeLight 作者: MeiK-h 项目源码 文件源码
def write_code(id, pid, language, code):
    '''??????????'''
    try:
        work_path = os.path.join(config.work_dir, str(id))
        os.mkdir(work_path)
    except OSError, e:
        logging.error(e)
        return False
    real_path = os.path.join(work_path, config.file_name[language])
    f = open(real_path, 'w')
    try:
        f.write(code.encode('utf-8', 'ignore'))
    except Exception, e:
        logging.error("%s not write code to file\n%s" % (id, e))
        f.close()
        return False
    f.close()
    #os.chmod(work_path, stat.S_IRWXO)
    #os.chmod(real_path, stat.S_IRWXO)
    return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号