signal-curses icon indicating copy to clipboard operation
signal-curses copied to clipboard

Index error: pop from an empty deque

Open reardenlife opened this issue 5 years ago • 7 comments

Unable to run due to the crash. The version of signal-curses is the last one.

[root@v48807 signal-curses]# python3 main.py -u +14107055522 --bus system -c /var/share/signal-cli/
Traceback (most recent call last):                                                                      File "/usr/local/lib/python3.8/site-packages/npyscreen/apNPSApplicationEvents.py", line 16, in get
    yield self.interal_queue.pop()                                                                    IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/npyscreen/apNPSApplicationEvents.py", line 18, in get
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "main.py", line 1002, in <module>
    signal.run()
  File "/usr/local/lib/python3.8/site-packages/npyscreen/apNPSApplication.py", line 30, in run
    return npyssafewrapper.wrapper(self.__remove_argument_call_main)                                    File "/usr/local/lib/python3.8/site-packages/npyscreen/npyssafewrapper.py", line 41, in wrapper
    wrapper_no_fork(call_function)
  File "/usr/local/lib/python3.8/site-packages/npyscreen/npyssafewrapper.py", line 97, in wrapper_no_fork
    return_code = call_function(_SCREEN)
  File "/usr/local/lib/python3.8/site-packages/npyscreen/apNPSApplication.py", line 25, in __remove_argument_call_main
    return self.main()
  File "/usr/local/lib/python3.8/site-packages/npyscreen/apNPSApplicationManaged.py", line 172, in main
    self._THISFORM.edit()                                                                               File "/usr/local/lib/python3.8/site-packages/npyscreen/fm_form_edit_loop.py", line 86, in edit
    self._widgets__[self.editw].edit()
  File "/usr/local/lib/python3.8/site-packages/npyscreen/wgmultiline.py", line 581, in edit
    self.get_and_use_key_press()
  File "/usr/local/lib/python3.8/site-packages/npyscreen/wgwidget.py", line 575, in get_and_use_key_press
    return self.try_while_waiting()
  File "/usr/local/lib/python3.8/site-packages/npyscreen/wgwidget.py", line 560, in try_while_waiting
    self.parent.parentApp._internal_while_waiting()
  File "/usr/local/lib/python3.8/site-packages/npyscreen/apNPSApplicationEvents.py", line 41, in _internal_while_waiting
    self.process_event_queues(max_events_per_queue=self.max_events_per_queue)
  File "/usr/local/lib/python3.8/site-packages/npyscreen/apNPSApplicationEvents.py", line 51, in process_event_queues
    for event in queue.get(maximum=max_events_per_queue):
RuntimeError: generator raised StopIteration
vi ^CException ignored in: <module 'threading' from '/usr/local/lib/python3.8/threading.py'>
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 1281, in _shutdown
    t.join()
  File "/usr/local/lib/python3.8/threading.py", line 1032, in join
    self._wait_for_tstate_lock()
  File "/usr/local/lib/python3.8/threading.py", line 1048, in _wait_for_tstate_lock
    elif lock.acquire(block, timeout):
  File "main.py", line 493, in sigint_handler
    exit(0)
  File "/usr/local/lib/python3.8/_sitebuiltins.py", line 26, in __call__
    raise SystemExit(code)
SystemExit: 0
[root@v48807 signal-curses]# python3 --version
Python 3.8.0a1+
[root@v48807 signal-curses]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

[root@v48807 signal-curses]# signal-cli -v
signal-cli 0.6.2

reardenlife avatar Feb 27 '19 16:02 reardenlife

I'm getting the same error.

herm avatar Mar 08 '19 17:03 herm

Sounds like the same issue as @7, just applied to Python 3.8 rather than 3.7.

Can you try my fork of npyscreen (https://github.com/jwoglom/npyscreen) which on line 18 of apNPSApplicationEvents.py does not have an explicit "raise StopIteration"?

jwoglom avatar Mar 10 '19 23:03 jwoglom

@jwoglom

Python 3.7.2:


Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/npyscreen/apNPSApplicationEvents.py", line 16, in get
    yield self.interal_queue.pop()                                                        IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:                       
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/npyscreen/apNPSApplicationEvents.py", line 18, in get
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "main.py", line 1002, in <module>
    signal.run()
  File "/usr/local/lib/python3.7/site-packages/npyscreen/apNPSApplication.py", line 30, in run
    return npyssafewrapper.wrapper(self.__remove_argument_call_main)
  File "/usr/local/lib/python3.7/site-packages/npyscreen/npyssafewrapper.py", line 41, in wrapper
    wrapper_no_fork(call_function)
  File "/usr/local/lib/python3.7/site-packages/npyscreen/npyssafewrapper.py", line 97, in wrapper_no_fork
    return_code = call_function(_SCREEN)
  File "/usr/local/lib/python3.7/site-packages/npyscreen/apNPSApplication.py", line 25, in __remove_argument_call_main
    return self.main()
  File "/usr/local/lib/python3.7/site-packages/npyscreen/apNPSApplicationManaged.py", line 172, in main
    self._THISFORM.edit()
  File "/usr/local/lib/python3.7/site-packages/npyscreen/fm_form_edit_loop.py", line 86, in edit
    self._widgets__[self.editw].edit()
  File "/usr/local/lib/python3.7/site-packages/npyscreen/wgmultiline.py", line 581, in edit
    self.get_and_use_key_press()
  File "/usr/local/lib/python3.7/site-packages/npyscreen/wgwidget.py", line 575, in get_and_use_key_press
    return self.try_while_waiting()
  File "/usr/local/lib/python3.7/site-packages/npyscreen/wgwidget.py", line 560, in try_while_waiting
    self.parent.parentApp._internal_while_waiting()
  File "/usr/local/lib/python3.7/site-packages/npyscreen/apNPSApplicationEvents.py", line 41, in _internal_while_waiting
    self.process_event_queues(max_events_per_queue=self.max_events_per_queue)
  File "/usr/local/lib/python3.7/site-packages/npyscreen/apNPSApplicationEvents.py", line 51, in process_event_queues
    for event in queue.get(maximum=max_events_per_queue):
RuntimeError: generator raised StopIteration
^CException ignored in: <module 'threading' from '/usr/local/lib/python3.7/threading.py'>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/threading.py", line 1273, in _shutdown
    t.join()
  File "/usr/local/lib/python3.7/threading.py", line 1032, in join
    self._wait_for_tstate_lock()
  File "/usr/local/lib/python3.7/threading.py", line 1048, in _wait_for_tstate_lock
    elif lock.acquire(block, timeout):
  File "main.py", line 493, in sigint_handler
    exit(0)
  File "/usr/local/lib/python3.7/_sitebuiltins.py", line 26, in __call__
    raise SystemExit(code)
SystemExit: 0
[root@v48807 signal-curses]# python3 --version
Python 3.7.2
[root@v48807 signal-curses]#

Will try your fork in a little bit. Thanks!

reardenlife avatar Mar 10 '19 23:03 reardenlife

@jwoglom

Alright. Your fork worked out good, I can see the interface. Yet I am unable to find any documentation. It is unclear for example how to add a new contact (I've got 0 right now).

reardenlife avatar Mar 13 '19 00:03 reardenlife

@reardenlife The contacts list piggybacks off of the contacts which are delivered to it via Signal. so if you have the application on your phone, then any contacts/threads should hopefully appear.

If not, I imagine you can manually add to the JSON in .local/share/signal-cli/data/+1your_phone (or wherever your data folder is) with something like:

"contactStore" : {
  "contacts" : [ {
    "name" : "[contact name]",
    "number" : "+1[phone]",
    "color" : "blue_grey",
    "profileKey" : "[some weird base64'd data, I think this can be set as a raw JSON null]"
  }, [..]

jwoglom avatar Mar 13 '19 01:03 jwoglom

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/npyscreen/apNPSApplicationEvents.py", line 16, in get
    yield self.interal_queue.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/npyscreen/apNPSApplicationEvents.py", line 18, in get
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "main.py", line 37, in <module>
    scurses.launcher.run(args)
  File "/Users/montreux/signal-curses/scurses/launcher/__init__.py", line 30, in run
    signal.run()
  File "/usr/local/lib/python3.8/site-packages/npyscreen/apNPSApplication.py", line 30, in run
    return npyssafewrapper.wrapper(self.__remove_argument_call_main)
  File "/usr/local/lib/python3.8/site-packages/npyscreen/npyssafewrapper.py", line 41, in wrapper
    wrapper_no_fork(call_function)
  File "/usr/local/lib/python3.8/site-packages/npyscreen/npyssafewrapper.py", line 97, in wrapper_no_fork
    return_code = call_function(_SCREEN)
  File "/usr/local/lib/python3.8/site-packages/npyscreen/apNPSApplication.py", line 25, in __remove_argument_call_main
    return self.main()
  File "/usr/local/lib/python3.8/site-packages/npyscreen/apNPSApplicationManaged.py", line 172, in main
    self._THISFORM.edit()
  File "/usr/local/lib/python3.8/site-packages/npyscreen/fm_form_edit_loop.py", line 86, in edit
    self._widgets__[self.editw].edit()
  File "/usr/local/lib/python3.8/site-packages/npyscreen/wgmultiline.py", line 581, in edit
    self.get_and_use_key_press()
  File "/usr/local/lib/python3.8/site-packages/npyscreen/wgwidget.py", line 575, in get_and_use_key_press
    return self.try_while_waiting()
  File "/usr/local/lib/python3.8/site-packages/npyscreen/wgwidget.py", line 560, in try_while_waiting
    self.parent.parentApp._internal_while_waiting()
  File "/usr/local/lib/python3.8/site-packages/npyscreen/apNPSApplicationEvents.py", line 41, in _internal_while_waiting
    self.process_event_queues(max_events_per_queue=self.max_events_per_queue)
  File "/usr/local/lib/python3.8/site-packages/npyscreen/apNPSApplicationEvents.py", line 51, in process_event_queues
    for event in queue.get(maximum=max_events_per_queue):
RuntimeError: generator raised StopIteration
org.freedesktop.dbus.exceptions.DBusException: Failed to connect to bus: No such file or directory
	at org.freedesktop.dbus.connections.AbstractConnection.<init>(AbstractConnection.java:166)
	at org.freedesktop.dbus.connections.impl.DBusConnection.<init>(DBusConnection.java:334)
	at org.freedesktop.dbus.connections.impl.DBusConnection.getConnection(DBusConnection.java:149)
	at org.freedesktop.dbus.connections.impl.DBusConnection.getConnection(DBusConnection.java:169)
	at org.freedesktop.dbus.connections.impl.DBusConnection.getConnection(DBusConnection.java:228)
	at org.freedesktop.dbus.connections.impl.DBusConnection.getConnection(DBusConnection.java:184)
	at org.asamk.signal.commands.DaemonCommand.handleCommand(DaemonCommand.java:51)
	at org.asamk.signal.Main.handleCommands(Main.java:181)
	at org.asamk.signal.Main.handleCommands(Main.java:132)
	at org.asamk.signal.Main.main(Main.java:64)
Caused by: java.io.IOException: No such file or directory
	at jnr.unixsocket.UnixSocketChannel.doConnect(UnixSocketChannel.java:127)
	at jnr.unixsocket.UnixSocketChannel.connect(UnixSocketChannel.java:136)
	at jnr.unixsocket.UnixSocketChannel.open(UnixSocketChannel.java:68)
	at org.freedesktop.dbus.connections.transports.UnixSocketTransport.connect(UnixSocketTransport.java:58)
	at org.freedesktop.dbus.connections.transports.TransportFactory.createTransport(TransportFactory.java:44)
	at org.freedesktop.dbus.connections.AbstractConnection.<init>(AbstractConnection.java:161)
	... 9 more

Don't know where to go from here. Using macos.

WangElectronics avatar Jul 17 '20 20:07 WangElectronics

@WangElectronics I have not been able to get dbus working properly on macos in some time -- it is quite finicky. Not sure where to lead you from there. Make sure you're running a dbus server on your machine.

jwoglom avatar Jul 17 '20 23:07 jwoglom