Open tejal567 opened 7 years ago
pexpect error comes when you don't have java installed. once check that
Try to copy the default.properties
file from https://github.com/dasmith/stanford-corenlp-python to your project directory.
Hi SaujanyaReddy
Why I have this error while running corenlp.py
File "corenlp.py", line 263, in
I have to execute this code on windows
, where the java has been installed
also I have copied the default.properties file from https://github.com/dasmith/stanford-corenlp-python
but the same error message occurs.
I'm wondering whether this code has been written for windows or any other Operating system ???
thanks
I think the error mentioned by @omarjnb is a different one. It occurs due to the fact that pexpect
doesn't work on Windows (see https://github.com/pexpect/pexpect/issues/321). So actually you can't use that wrapper on Windows. However, if you don't need to import CoreNLP as a module into your Python program but only want to call it as a web service, you can use the official HTTP API provided by CoreNLP server (at least in the latest version 3.8.0). Check CoreNLP's documention for more information.
@n1try, great job helping people out man. I used your fix of adding the default.properties file and it worked but I am getting another error, think you can help?
Loading Models: 5/5 Traceback (most recent call last): File "corenlp.py", line 257, in <module> nlp = StanfordCoreNLP() File "corenlp.py", line 178, in __init__ self.corenlp.expect("Entering interactive shell.") File "/home/whiskey/.local/lib/python2.7/site-packages/pexpect/spawnbase.py", line 341, in expect timeout, searchwindowsize, async_) File "/home/whiskey/.local/lib/python2.7/site-packages/pexpect/spawnbase.py", line 369, in expect_list return exp.expect_loop(timeout) File "/home/whiskey/.local/lib/python2.7/site-packages/pexpect/expect.py", line 116, in expect_loop return self.timeout(e) File "/home/whiskey/.local/lib/python2.7/site-packages/pexpect/expect.py", line 80, in timeout raise TIMEOUT(msg) pexpect.exceptions.TIMEOUT: Timeout exceeded. <pexpect.pty_spawn.spawn object at 0x7fdde94edf10> command: /usr/bin/java args: ['/usr/bin/java', '-Xmx1800m', '-cp', './stanford-corenlp-full-2018-02-27/stanford-corenlp-3.9.1.jar:./stanford-corenlp-full-2018-02-27/stanford-corenlp-3.9.1-models.jar:./stanford-corenlp-full-2018-02-27/joda-time.jar:./stanford-corenlp-full-2018-02-27/xom.jar:./stanford-corenlp-full-2018-02-27/jollyday.jar', 'edu.stanford.nlp.pipeline.StanfordCoreNLP', '-props', 'default.properties'] buffer (last 100 chars): '[0.6 sec].\r\nAdding annotator dcoref\r\n' before (last 100 chars): '[0.6 sec].\r\nAdding annotator dcoref\r\n' after: <class 'pexpect.exceptions.TIMEOUT'> match: None match_index: None exitstatus: None flag_eof: False pid: 108316 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("Entering interactive shell.")
While running corenlp.py, it is giving an error. Can you point out some specific thing that we may have missed out based on your instructions.