Skip to content

NameError: name 'open' is not defined #1563

@revolter

Description

@revolter

Steps to reproduce

Expected behaviour

Tell us what should happen

Actual behaviour

I'm getting some errors related to asyncio and tornado in production. I didn't get them locally.

Configuration

Operating System:

Ubuntu 16.04.6 LTS

Version of Python, python-telegram-bot & dependencies:

python-telegram-bot 12.2.0
certifi 2019.09.11
future 0.18.0
Python 3.5.2 (default, Oct  8 2019, 13:06:37)  [GCC 5.4.0 20160609]

Logs

2019-10-17 22:19:04,457 - asyncio - ERROR - Task was destroyed but it is pending!
task: <Task pending coro=<HTTP1ServerConnection._server_request_loop() running at /home/ubuntu/.local/share/virtualenvs/FileConvertBot-QIl0H4VU/lib/python3.5/site-packages/tornado/http1connection.py:817> wait_for=<Future pending cb=[Task._wakeup()]> cb=[IOLoop.add_future.<locals>.<lambda>() at /home/ubuntu/.local/share/virtualenvs/FileConvertBot-QIl0H4VU/lib/python3.5/site-packages/tornado/ioloop.py:690]>
2019-10-17 22:19:04,458 - asyncio - ERROR - Exception in default exception handler
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/base_events.py", line 1171, in call_exception_handler
    self.default_exception_handler(context)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 1148, in default_exception_handler
    logger.error('\n'.join(log_lines), exc_info=exc_info)
  File "/usr/lib/python3.5/logging/__init__.py", line 1308, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python3.5/logging/__init__.py", line 1415, in _log
    self.handle(record)
  File "/usr/lib/python3.5/logging/__init__.py", line 1425, in handle
    self.callHandlers(record)
  File "/usr/lib/python3.5/logging/__init__.py", line 1487, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python3.5/logging/__init__.py", line 855, in handle
    self.emit(record)
  File "/usr/lib/python3.5/logging/__init__.py", line 1047, in emit
    self.stream = self._open()
  File "/usr/lib/python3.5/logging/__init__.py", line 1037, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
NameError: name 'open' is not defined
Exception ignored in: <bound method Task.__del__ of <Task pending coro=<HTTP1ServerConnection._server_request_loop() running at /home/ubuntu/.local/share/virtualenvs/FileConvertBot-QIl0H4VU/lib/python3.5/site-packages/tornado/http1connection.py:817> wait_for=<Future pending cb=[Task._wakeup()]> cb=[IOLoop.add_future.<locals>.<lambda>() at /home/ubuntu/.local/share/virtualenvs/FileConvertBot-QIl0H4VU/lib/python3.5/site-packages/tornado/ioloop.py:690]>>
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 92, in __del__
  File "/usr/lib/python3.5/asyncio/base_events.py", line 1177, in call_exception_handler
  File "/usr/lib/python3.5/logging/__init__.py", line 1308, in error
  File "/usr/lib/python3.5/logging/__init__.py", line 1415, in _log
  File "/usr/lib/python3.5/logging/__init__.py", line 1425, in handle
  File "/usr/lib/python3.5/logging/__init__.py", line 1487, in callHandlers
  File "/usr/lib/python3.5/logging/__init__.py", line 855, in handle
  File "/usr/lib/python3.5/logging/__init__.py", line 1047, in emit
  File "/usr/lib/python3.5/logging/__init__.py", line 1037, in _open
NameError: name 'open' is not defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions