• python xlsxwriter创建excel 之('Exception caught in workbook destructor. Explicit close() may be required for workbook.',)


    python2.7使用xlsxwriter创建excel ,不关闭xlsxwriter对象,会报错:

    Exception Exception: Exception('Exception caught in workbook destructor. Explicit close() may be required for workbook.',) in <bound method Workbook.__del__ of <xlsxwriter.workbook.Workbook object at 0x0000000002215400>> ignored

    脚本如下:

    #coding=utf-8
    import xlsxwriter
    
    #创建excel文件
    workbook = xlsxwriter.Workbook('test.xlsx')
    worksheet = workbook.add_worksheet('test')

    报错信息如下:

    查资料才知道 一定要把xlsxwriter对象给关闭了,加上workbook.close()后,完美解决 文件创建成功,如下截图:

     注:python3.6版本没此问题,不用workbook.close(),也可以执行成功!

  • 相关阅读:
    Out of Hay POJ
    Sum Problem hdu 1001
    N! hdu 1042
    线性表的链式表示和实现(插入删除建空合并)
    NYOJ 1007
    NYOJ 954
    NYOJ 998
    NYOJ 455
    NYOJ 975
    数据结构复习0---线性表
  • 原文地址:https://www.cnblogs.com/feiyueNotes/p/7789916.html
Copyright © 2020-2023  润新知