[Python] Getting a pexpect EOF error when trying to run Stanford CoreNLP

Discussão em 'Python' iniciado por Stack, Fevereiro 28, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to run Stanford's CoreNLP using a Python wrapper. When I run the code I get the error message:

    Traceback (most recent call last):
    File "./corenlp.py", line 257, in <module>
    nlp = StanfordCoreNLP()
    File "./corenlp.py", line 176, in __init__
    self.corenlp.expect("done.", timeout=200) # Loading PCFG (~3sec)
    File "/home/user1/anaconda3/envs/user1conda/lib/python3.7/site-packages/pexpect/spawnbase.py", line 344, in expect
    timeout, searchwindowsize, async_)
    File "/home/user1/anaconda3/envs/user1conda/lib/python3.7/site-packages/pexpect/spawnbase.py", line 372, in expect_list
    return exp.expect_loop(timeout)
    File "/home/user1/anaconda3/envs/user1conda/lib/python3.7/site-packages/pexpect/expect.py", line 179, in expect_loop
    return self.eof(e)
    File "/home/user1/anaconda3/envs/user1conda/lib/python3.7/site-packages/pexpect/expect.py", line 122, in eof
    raise exc
    pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
    <pexpect.pty_spawn.spawn object at 0x7fde11758350>
    command: /home/user1/anaconda3/envs/user1conda/bin/java
    args: ['/home/user1/anaconda3/envs/user1conda/bin/java', '-Xmx1800m', '-cp', './stanford-corenlp-python/stanford-corenlp-full-2018-10-05/stanford-corenlp-3.9.2.jar:./stanford-corenlp-python/stanford-corenlp-full-2018-10-05/stanford-corenlp-3.9.2-models.jar:./stanford-corenlp-python/stanford-corenlp-full-2018-10-05/joda-time.jar:./stanford-corenlp-python/stanford-corenlp-full-2018-10-05/xom.jar:./stanford-corenlp-python/stanford-corenlp-full-2018-10-05/jollyday.jar', 'edu.stanford.nlp.pipeline.StanfordCoreNLP', '-props', 'default.properties']
    buffer (last 100 chars): b''
    before (last 100 chars): b'rdCoreNLP.java:188)\r\n\tat edu.stanford.nlp.pipeline.StanfordCoreNLP.main(StanfordCoreNLP.java:1388)\r\n'
    after: <class 'pexpect.exceptions.EOF'>
    match: None
    match_index: None
    exitstatus: None
    flag_eof: True
    pid: 28826
    child_fd: 5
    closed: False
    timeout: 30
    delimiter: <class 'pexpect.exceptions.EOF'>
    logfile: None
    logfile_read: None
    logfile_send: None
    maxread: 2000
    ignorecase: False
    searchwindowsize: None
    delaybeforesend: 0.05
    delayafterclose: 0.1
    delayafterterminate: 0.1
    searcher: searcher_re:
    0: re.compile(b'done.')


    I've tried looking at some other answers here, but wasn't able to find a solution to my problem. This question from two years ago is on the same lines of mine, but has no answers.

    What might be some things I could try? Thanks.

    Continue reading...

Compartilhe esta Página