OpenSesame icon indicating copy to clipboard operation
OpenSesame copied to clipboard

undo_manager crashes when the script fails to parse due to a missing closing quotation

Open smathot opened this issue 5 years ago • 1 comments

This came in as an automated bug report. It appears to happen because the (intentional) exception that is raised when a closing quotation is missing causes the undo_manager extension to crash.

Traceback (most recent call last):
  File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\syntax.py", line 185, in split
    return shlex.split(s)
  File "C:\Program Files (x86)\OpenSesame\lib\shlex.py", line 310, in split
    return list(lex)
  File "C:\Program Files (x86)\OpenSesame\lib\shlex.py", line 299, in __next__
    token = self.get_token()
  File "C:\Program Files (x86)\OpenSesame\lib\shlex.py", line 109, in get_token
    raw = self.read_token()
  File "C:\Program Files (x86)\OpenSesame\lib\shlex.py", line 191, in read_token
    raise ValueError("No closing quotation")
ValueError: No closing quotation

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libqtopensesame\extensions\_extension_manager.py", line 41, in inner
    retval = fnc(self, *args, **kwdict)
  File "C:\Program Files (x86)\OpenSesame\share\opensesame_extensions\undo_manager\undo_manager.py", line 207, in undo
    self.experiment.items[item].from_string(script)
  File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\loop.py", line 77, in from_string
    self.parse_variable(i)
  File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\item.py", line 132, in parse_variable
    l = self.syntax.split(line.strip())
  File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\syntax.py", line 192, in split
    % s, exception=e)
libopensesame.exceptions.osexception: 
Failed to parse line "[masked for privacy]". Is there a closing quotation missing?

smathot avatar Oct 28 '20 20:10 smathot

It's unclear how this error can arise, because it seems to require that a syntactically invalid script is pushed to the undo stack, and that strikes me as impossible. Yet the error is there. Perhaps it happens for a specific item type.

smathot avatar Nov 24 '20 19:11 smathot