gencache.py 文件源码

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

项目:pupy 作者: ru-faraon 项目源码 文件源码
def GetGeneratePath():
    """Returns the name of the path to generate to.
    Checks the directory is OK.
    """
    assert not is_readonly, "Why do you want the genpath for a readonly store?"
    try:
        os.makedirs(win32com.__gen_path__)
        #os.mkdir(win32com.__gen_path__)
    except os.error:
        pass
    try:
        fname = os.path.join(win32com.__gen_path__, "__init__.py")
        os.stat(fname)
    except os.error:
        f = open(fname,"w")
        f.write('# Generated file - this directory may be deleted to reset the COM cache...\n')
        f.write('import win32com\n')
        f.write('if __path__[:-1] != win32com.__gen_path__: __path__.append(win32com.__gen_path__)\n')
        f.close()

    return win32com.__gen_path__

#
# The helpers for win32com.client.Dispatch and OCX clients.
#
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号