Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] During startup, Obico throw a number of Python errors in the octoprint.log (most due to not having a nozzle cam) #227

Open
puterboy opened this issue Jan 29, 2024 · 0 comments

Comments

@puterboy
Copy link
Contributor

puterboy commented Jan 29, 2024

Minor bug - more of an annoyance.
Obico plugin throws about 7 Python-traceback errrors into octoprint.log at startup -- most if not all seem to be due to lack of nozzle cam or timing/sequencing where snapshots, connections, or Janus are requested before they are set up.
None of this seems to have any practical effect as everything seems to be working (I don't have a nozzle cam so don't know about that).

But it would be good to catch these errors and either ignore them (if they are normal) or log an error/warning rather than throwing a Python code error.

Not high priority but just wanted to share for the record...

Here is a sample from startup:
1. Error # 1: No Nozzle config

2024-01-28 21:34:37,529 - octoprint.plugins.obico - ERROR - Failed to build nozzle config
Traceback (most recent call last):
  File "/home/myuser/octoprint/venv/lib/python3.11/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 372, in decode
    obj, end = self.raw_decode(s)
               ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 402, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
simplejson.errors.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

2. Error # 2: Another nozzle cam error


Traceback (most recent call last):
  File "/home/myuser/octoprint/venv/lib/python3.11/site-packages/octoprint_obico/nozzlecam.py", line 52, in create_nozzlecam_config
    ext_info = info.json().get('ext')
               ^^^^^^^^^^^
  File "/home/myuser/octoprint/venv/lib/python3.11/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

3. Error # 3 Trying to take snapshot before camera streaming started

2024-01-28 21:34:37,781 - octoprint.plugins.octoapp - ERROR - Failed to get webcam snapshot; ConnectionError Exception: HTTPConnectionPool(host='octopi', port=8080): Max retries e\
xceeded with url: /?action=snapshot (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ffeb020d610>: Failed to establish a new connection: [Errno 111] \
Connection refused')); Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 96, in create_connection
    raise err
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 86, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

4. Error # 4: Maybe another timing/sequencing issue

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 704, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 399, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 239, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  File "/usr/lib/python3.11/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1037, in _send_output
    self.send(msg)
  File "/usr/lib/python3.11/http/client.py", line 975, in send
    self.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 205, in connect
    conn = self._new_conn()
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7ffeb020d610>: Failed to establish a new connection: [Errno 111] Connection refused

5. Error # 5: Similar

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/myuser/octoprint/venv/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 788, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='octopi', port=8080): Max retries exceeded with url: /?action=snapshot (Caused by NewConnectionError('<urllib3.connection\
.HTTPConnection object at 0x7ffeb020d610>: Failed to establish a new connection: [Errno 111] Connection refused'))

6. Error # 6: Similar

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/myuser/octoprint/venv/lib/python3.11/site-packages/octoprint_octoapp/webcamsnapshots.py", line 124, in _updateSnapshotCache
    raw = requests.get(snapshotUrl, timeout=float(15), stream=True)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/octoprint/venv/lib/python3.11/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/octoprint/venv/lib/python3.11/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/octoprint/venv/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/octoprint/venv/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myuser/octoprint/venv/lib/python3.11/site-packages/requests/adapters.py", line 519, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='octopi', port=8080): Max retries exceeded with url: /?action=snapshot (Caused by NewConnectionError('<urllib3.connect\
ion.HTTPConnection object at 0x7ffeb020d610>: Failed to establish a new connection: [Errno 111] Connection refused'))

7. Error # 7: Janus startup error

2024-01-28 21:34:45,438 - backoff - ERROR - Giving up run_janus(...) after 5 tries (Exception: Janus quit! This should not happen. Exit code: 1)
2024-01-28 21:34:45,438 - octoprint.plugins.obico - ERROR - Exception
Traceback (most recent call last):
  File "/home/kosowsky/octoprint/venv/lib/python3.11/site-packages/octoprint_obico/janus.py", line 90, in run_janus_forever
    run_janus()
  File "/home/kosowsky/octoprint/venv/lib/python3.11/site-packages/backoff/_sync.py", line 105, in retry
    ret = target(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kosowsky/octoprint/venv/lib/python3.11/site-packages/octoprint_obico/janus.py", line 86, in run_janus
    raise Exception('Janus quit! This should not happen. Exit code: {}'.format(self.janus_proc.returncode))
Exception: Janus quit! This should not happen. Exit code: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant