genelkim / ulf2english

Maps EL-ULFs to English sentences.
MIT License
1 stars 0 forks source link

py4cl failure on Python >3.6 #58

Open genelkim opened 4 years ago

genelkim commented 4 years ago

Starting with Python 3.7 generators handle StopIteration errors. In SBCL we get

| Python error: "generator raised StopIteration"

The smallest example I've been able to find to replicate this is.

* (ql:quickload :py4cl)
* (py4cl:python-exec "from pattern import en")
* (py4cl:python-eval "en.conjugate(\"BE\",tense=en.PRESENT,person=3,number=en.SG,mood=en.INDICATIVE,aspect=\"imperfective\",negated=False,parse=True)")

debugger invoked on a PY4CL:PYTHON-ERROR in thread
#<THREAD "main thread" RUNNING {10008B8083}>:
  Python error: "generator raised StopIteration"

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

(PY4CL::DISPATCH-MESSAGES #<UIOP/LAUNCH-PROGRAM::PROCESS-INFO {1003B4C5A3}>)
   source: (ERROR 'PYTHON-ERROR :TEXT (STREAM-READ-STRING READ-STREAM))
genelkim commented 4 years ago

For now, we're getting around it with a hacky restart since it doesn't seem to reoccur (https://github.com/genelkim/ulf2english/pull/59). TODO: Raise this issue in py4cl. Perhaps find a smaller example? Or just point to this stackoverflow answer which itself points to a change in the python guidelines https://stackoverflow.com/a/51701040.