rsennrich / ParZu

The Zurich Dependency Parser for German

Home Page:https://pub.cl.uzh.ch/demo/parzu/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pexpect error on init

jban-x3 opened this issue · comments

Running your test code

import parzu_class as parzu
options = parzu.process_arguments()
options['verbose']      = False
options['linewise']     = True
options['morphology']   = 'smor'
options['outputformat'] = 'prolog'
ParZu = parzu.Parser(options)

sentences = ParZu.main('Das ist ein Test. Das auch.')
for sentence in sentences:
    print(sentence)`

i get the following error.

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pexpect/expect.py", line 111, in expect_loop
    incoming = spawn.read_nonblocking(spawn.maxread, timeout)
  File "/usr/local/lib/python3.8/site-packages/pexpect/pty_spawn.py", line 486, in read_nonblocking
    return super(spawn, self).read_nonblocking(size)
  File "/usr/local/lib/python3.8/site-packages/pexpect/spawnbase.py", line 176, in read_nonblocking
    raise EOF('End Of File (EOF). Empty string style platform.')
pexpect.exceptions.EOF: End Of File (EOF). Empty string style platform.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "skripte.py", line 9, in <module>
    ParZu = parzu.Parser(options)
  File "/Users/xxx/Sites/generator_dashboard/app/parzu/parzu_class.py", line 278, in __init__
    self.prolog_parser.expect_exact('?- ')
  File "/usr/local/lib/python3.8/site-packages/pexpect/spawnbase.py", line 418, in expect_exact
    return exp.expect_loop(timeout)
  File "/usr/local/lib/python3.8/site-packages/pexpect/expect.py", line 117, in expect_loop
    return self.eof(e)
  File "/usr/local/lib/python3.8/site-packages/pexpect/expect.py", line 63, in eof
    raise EOF(msg)
pexpect.exceptions.EOF: End Of File (EOF). Empty string style platform.
<pexpect.pty_spawn.spawn object at 0x1017665b0>
command: /usr/local/bin/swipl
args: [b'/usr/local/bin/swipl', b'-q', b'-s', b'ParZu-parser.pl', b'-G248M', b'-L248M']
buffer (last 100 chars): ''
before (last 100 chars): ", --name, --no-name or --noname.\r\nBoth '-' or '_' are accepted as word-separator for long options.\r\n"
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: None
flag_eof: True
pid: 23996
child_fd: 10
closed: False
timeout: 100
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_string:
    0: '?- '

I use swipl 8.2.1 and pexpect 4.6.0 on a mac.

Do you have any idea?

The reason why this happens depends on the version of swi-prolog. With version 7.6 i get no errors.
Maybe you (@rsennrich) could update your code to be able to use the current version of swi-prolog.

thanks for reporting this. Looks like the command line arguments for swi-prolog have changed in 7.7. This is now fixed.