Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sforce100 opened this issue Oct 5, 2023 · 1 comment
Labels

Comments

@sforce100
Copy link

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)

@mrkn
Copy link
Owner

mrkn commented May 20, 2024

@sforce100 How do I reproduce the error?

@mrkn mrkn added the feedback label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants