Closed mirh closed 3 years ago
Thanks for reporting this. I've seen this error myself too, but it's very hard to reproduce. Are you able to reproduce it reliably? If so, what are the steps? And a few questions to narrow the issue down:
Aren't they two separate issues? Like, maybe I'm just too much of a python noob, but I don't see "_share_id" (or SHARE_COUNT) defined anywhere else in the project or its dependencies but the part where it crashes because it cannot find it. ... did you actually ever verified the auto restart feature?
Anyway I had literally just unpacked the program and run it for the first (or second at most?) time. I cannot really remember much details since I was already overloaded with tasks to keep in mind in a conference.
AFAICT I didn't change any setting, except perhaps font size (Idk if I did this sooner or later, and I went from 14pt to 12pt because other wise words were pretty huge with 125% HiDPI scaling) Console and runner are multiprocess and python.
The error can be reproduced with the following steps:
del __builtins__._
Possibly, some library deletes _
from the built-ins, although it's not clear to me which library does this and why. In any case, re-installing _
before step 4 (per the script below) fixes the issues. A potential fix might therefore be to check whether _
exists before initializing a new code editor, and if not re-install it explicitly.
import gettext
gettext.NullTranslations().install()
Aren't they two separate issues?
They are related. The second AttributeError
is a consequence of the first NameError
, which prevents the code editor from initializing.
I just experienced it for the first time also on Ubuntu (so apparently it's not Windows-specific). This happens consistently after just opening OpenSesame and then going to the backend settings.
Traceback (most recent call last):
File "/usr/share/opensesame_extensions/preload_items/preload_items.py", line 73, in _on_awake
self._preload_one_item()
File "/usr/share/opensesame_extensions/preload_items/preload_items.py", line 87, in _preload_one_item
item.init_edit_widget()
File "/usr/lib/python3/dist-packages/libqtopensesame/items/qtautoplugin.py", line 112, in init_edit_widget
widget = self.add_editor_control(c[u'var'], c[u'label'],
File "/usr/lib/python3/dist-packages/libqtopensesame/items/qtplugin.py", line 425, in add_editor_control
editor = CodeEdit(self.main_window)
File "/usr/share/opensesame_extensions/pyqode_manager/pyqode_extras/widgets/text_code_edit.py", line 49, in __init__
super(TextCodeEdit, self).__init__(parent)
File "/usr/lib/python3/dist-packages/pyqode/core/api/code_edit.py", line 493, in __init__
self._init_actions(create_default_actions)
File "/usr/lib/python3/dist-packages/pyqode/core/api/code_edit.py", line 1248, in _init_actions
menu_advanced = QtWidgets.QMenu(_('Advanced'), self)
NameError: name '_' is not defined
I was doing basically nothing with your basic starting example, when this happened:
And then every time the tab tried to restart (I think it was a sketchpad, but I could be wrong), I got this in an infinite loop: