hello-robot/stretch_body

NameError: 'exit' not defined when exiting Stretch Body

Closed this issue · 1 comments

hello-user@stretch-se3-3004:~$ ipython3
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.31.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import stretch_body.robot

In [2]: r = stretch_body.robot.Robot()

In [3]: r.startup()
Out[3]: True

In [4]: r.stop()

In [5]:                                                                                                                                                                                                                                                                            
Do you really want to exit ([y]/n)? 
Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/hello-user/repos/stretch_body/body/stretch_body/robot_collision.py", line 380, in _collision_compute_worker
    collision_compute.step(shared_joint_cfg)
  File "/home/hello-user/repos/stretch_body/body/stretch_body/robot_collision.py", line 631, in step
    _cfg = cfg.get()
  File "/usr/lib/python3.10/multiprocessing/queues.py", line 103, in get
    res = self._recv_bytes()
  File "/usr/lib/python3.10/multiprocessing/connection.py", line 216, in recv_bytes
    buf = self._recv_bytes(maxlength)
  File "/usr/lib/python3.10/multiprocessing/connection.py", line 414, in _recv_bytes
    buf = self._recv(4)
  File "/usr/lib/python3.10/multiprocessing/connection.py", line 379, in _recv
    chunk = read(handle, remaining)
  File "/home/hello-user/repos/stretch_body/body/stretch_body/robot_collision.py", line 388, in signal_handler
    exit(0)
NameError: name 'exit' is not defined
hello-user@stretch-se3-3004:~$ ipython3
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.31.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import stretch_body.robot

In [2]: r = stretch_body.robot.Robot()

In [3]: r.startup()
Out[3]: True

In [4]:                                                                                                                                                                                                                                                                            
Do you really want to exit ([y]/n)? 
Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/hello-user/repos/stretch_body/body/stretch_body/robot_collision.py", line 376, in _collision_compute_worker
    time.sleep(0.5)
  File "/home/hello-user/repos/stretch_body/body/stretch_body/robot_collision.py", line 388, in signal_handler
    exit(0)
NameError: name 'exit' is not defined

Note that I was using iPython, and was using a separate account from the default 'hello-robot' account. These details may or may not be important.

This bug is fixed with this fix