Skip to content

call with docx module, GIL is released (the current Python thread state is NULL) #171

@sforce100

Description

@sforce100

my python script call second time, get this error :

Fatal Python error: PyThreadState_Get: the function must be called with the GIL held, but the GIL is released (the current Python thread state is NULL)
Python runtime state: initialized

my python script is:

from docx import Document

from docx.text.paragraph import Paragraph
from docx.table import Table
from docx.oxml.text.paragraph import CT_P
from docx.oxml.table import CT_Tbl


def trans_text(text):
    from harvesttext import HarvestText
    ht0 = HarvestText()
    return ht0.clean_text(text)


def extract_all_table_data_with_context(docx_filename):

    doc = Document(docx_filename)
    all_table_data = []
    table_context = None
    current_table_data = None
    for child in doc.element.body.iterchildren():
        print(child)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions