home-assistant-libs / ha-ffmpeg

A python library that handling with ffmpeg for home-assistant
BSD 3-Clause "New" or "Revised" License
16 stars 13 forks source link

AttributeError: 'bool' object has no attribute 'read' #18

Closed bachya closed 6 years ago

bachya commented 6 years ago

Getting this exception for some MP4s – let me know what other info I can provide:

2017-10-08 17:00:03 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 422, in start
    resp = yield from self._request_handler(request)
  File "/usr/lib/python3.6/site-packages/aiohttp/web.py", line 306, in _handle
    resp = yield from handler(request)
  File "/usr/lib/python3.6/asyncio/coroutines.py", line 213, in coro
    res = yield from res
  File "/usr/lib/python3.6/asyncio/coroutines.py", line 213, in coro
    res = yield from res
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/ban.py", line 58, in ban_middleware_handler
    return (yield from handler(request))
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/__init__.py", line 428, in handle
    result = yield from result
  File "/usr/lib/python3.6/site-packages/homeassistant/components/camera/__init__.py", line 340, in get
    response = yield from self.handle(request, camera)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/camera/__init__.py", line 360, in handle
    image = yield from camera.async_camera_image()
  File "/config/custom_components/camera/yi.py", line 126, in async_camera_image
    url, output_format=IMAGE_JPEG, extra_cmd=self._extra_arguments)
  File "/config/deps/lib/python3.6/site-packages/haffmpeg/tools.py", line 76, in get_image
    extra_cmd=extra_cmd)
  File "/config/deps/lib/python3.6/site-packages/haffmpeg/core.py", line 104, in open
    self._generate_ffmpeg_cmd(cmd, input_source, output, extra_cmd)
  File "/config/deps/lib/python3.6/site-packages/haffmpeg/core.py", line 38, in _generate_ffmpeg_cmd
    self._put_input(input_source)
  File "/config/deps/lib/python3.6/site-packages/haffmpeg/core.py", line 50, in _put_input
    input_cmd = shlex.split(input_source)
  File "/usr/lib/python3.6/shlex.py", line 305, in split
    return list(lex)
  File "/usr/lib/python3.6/shlex.py", line 295, in __next__
    token = self.get_token()
  File "/usr/lib/python3.6/shlex.py", line 105, in get_token
    raw = self.read_token()
  File "/usr/lib/python3.6/shlex.py", line 136, in read_token
    nextchar = self.instream.read(1)
AttributeError: 'bool' object has no attribute 'read'
pvizeli commented 6 years ago

Can you provide the config? You can send me a private message in discord/Home-Assistant

bachya commented 6 years ago

This is coming from a new camera platform I'm working on: https://github.com/home-assistant/home-assistant/pull/9743. You won't be able to access a stream, per se, but I could send you a sample MP4 that the platform downloads; would that help?

bachya commented 6 years ago

Saw this again today:

2017-10-16 21:01:47 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 422, in start
    resp = yield from self._request_handler(request)
  File "/usr/lib/python3.6/site-packages/aiohttp/web.py", line 306, in _handle
    resp = yield from handler(request)
  File "/usr/lib/python3.6/asyncio/coroutines.py", line 213, in coro
    res = yield from res
  File "/usr/lib/python3.6/asyncio/coroutines.py", line 213, in coro
    res = yield from res
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/ban.py", line 58, in ban_middleware_handler
    return (yield from handler(request))
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/__init__.py", line 428, in handle
    result = yield from result
  File "/usr/lib/python3.6/site-packages/homeassistant/components/camera/__init__.py", line 340, in get
    response = yield from self.handle(request, camera)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/camera/__init__.py", line 360, in handle
    image = yield from camera.async_camera_image()
  File "/config/custom_components/camera/yi.py", line 119, in async_camera_image
    url, output_format=IMAGE_JPEG, extra_cmd=self._extra_arguments)
  File "/config/deps/lib/python3.6/site-packages/haffmpeg/tools.py", line 76, in get_image
    extra_cmd=extra_cmd)
  File "/config/deps/lib/python3.6/site-packages/haffmpeg/core.py", line 104, in open
    self._generate_ffmpeg_cmd(cmd, input_source, output, extra_cmd)
  File "/config/deps/lib/python3.6/site-packages/haffmpeg/core.py", line 38, in _generate_ffmpeg_cmd
    self._put_input(input_source)
  File "/config/deps/lib/python3.6/site-packages/haffmpeg/core.py", line 50, in _put_input
    input_cmd = shlex.split(input_source)
  File "/usr/lib/python3.6/shlex.py", line 305, in split
    return list(lex)
  File "/usr/lib/python3.6/shlex.py", line 295, in __next__
    token = self.get_token()
  File "/usr/lib/python3.6/shlex.py", line 105, in get_token
    raw = self.read_token()
  File "/usr/lib/python3.6/shlex.py", line 136, in read_token
    nextchar = self.instream.read(1)
AttributeError: 'bool' object has no attribute 'read'