LoginSignup
5
6

More than 3 years have passed since last update.

TelloPyでハマった事と対処方法

Last updated at Posted at 2019-05-23

このページは?

  • トイドローンTelloをPythonで操作するライブラリTelloPy利用時に遭遇した問題(Issue)と対処方法を記載しています。
    https://github.com/hanyazou/TelloPy
  • 自分用メモなので環境によって事象/対処方法は異なる可能性があります。

前提事項

  • 検証PC
    • Windows 10 Professional
    • Visual Studio 2017, Python3.7 導入済み(非Anaconda環境)
  • 検証ドローン … 無印Tello

Issues

PyAV導入時に 'cl.exe' が見つからないエラー発生

事象

pip install av 実行が下記エラーにより失敗。

‘error: command 'cl.exe' failed: No such file or directory‘  

対応方法

  1. 下記URLを開く
    https://visualstudio.microsoft.com/ja/downloads/
  2. Tools for Visual Studio 2017 のセクションを展開し Build Tools Visual Studio 2017ダウンロードボタンをクリック。その後は指示に従ってインストール
  3. プログラムから VS 2017用 x64_x86 Cross Toolsコマンド プロンプト を起動してpip install av 実行
    ---> 本エラーは解消

PyAV導入時に 'avfilter.lib' が見つからないエラー発生

事象

pip install av 実行が下記エラーにより失敗

LINK : fatal error LNK1181: 入力ファイル 'avfilter.lib' を開けません。

対応方法

  1. 下記URLを開く
    https://ffmpeg.zeranoe.com/builds/
  2. 該当するArchitecture を選択し、LinkageのSharedDev をそれぞれ選択してDownload Buildを押下
  3. ダウンロードしたファイルを展開し任意のフォルダ(ここではC:\dev\ffmpeg)に配置
  4. VS 2017用 x64_x86 Cross Toolsコマンド プロンプト を開いて下記コマンドを実行後にpip install av 実行

    set INCLUDE=%INCLUDE%;c:\dev\ffmpeg\include
    set LIB=%LIB%;c:\dev\ffmpeg\lib
    set PATH=%PATH%;c:\dev\ffmpeg\bin
    

    ---> 本エラーは解消

PyAV導入時に アーキテクチャ競合エラー発生

事象

pip install av 実行が下記エラーにより失敗

python37.lib(python37.dll) : fatal error LNK1112: モジュールのコンピューターの種類 'x64' は対象コンピューターの種類 'x86' と競合しています。

対応方法

python3.7を64bit版から32bit版に入れ替えて本エラーは解消。(併せてffmpegも32bit版に入れ替え)
しかし、この対処方法で正しいのか不明…

サンプル実行時にffmpeg関連ライブラリが参照できないエラー

事象

py -m video_effect.py 実行時に下記エラーが発生。

C:\Users\<ユーザー名>\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\tellopy\examples>py -m video_effect.py
Traceback (most recent call last):
  File "C:\Users\<ユーザー名>\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "C:\Users\<ユーザー名>\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "C:\Users\<ユーザー名>\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\tellopy\examples\video_effect.py", line 4, in <module>
    import av
  File "C:\Users\<ユーザー名>\AppData\Local\Programs\Python\Python37-32\lib\site-packages\av\__init__.py", line 9, in <module>
    from av._core import time_base, pyav_version as __version__
ImportError: DLL load failed: 指定されたモジュールが見つかりません。

対応方法

VS 2017用 x64_x86 Cross Toolsコマンド プロンプト を開いて下記コマンド実行でffmpegへの参照を追加することで解消

set INCLUDE=%INCLUDE%;c:\dev\ffmpeg\include
set LIB=%LIB%;c:\dev\ffmpeg\lib
set PATH=%PATH%;c:\dev\ffmpeg\bin

Videoを使うサンプル実行時にmplayerが見つからないエラー発生

事象

python -m tellopy.examples.joystick_and_video 実行時に下記エラー発生

Tello: 23:29:25.923: Error: video recv: [WinError 2] 指定されたファイルが見つかりません。
Traceback (most recent call last):
  File "C:\Users\<ユーザー名>\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tellopy\_internal\tello.py", line 694, in __video_thread
    self.__publish(event=self.EVENT_VIDEO_FRAME, data=data[2:])
  File "C:\Users\<ユーザー名>\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tellopy\_internal\tello.py", line 154, in __publish
    dispatcher.send(event, sender=self, **args)
  File "C:\Users\<ユーザー名>\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tellopy\_internal\dispatcher.py", line 35, in send
    receiver(event=sig, **named)
  File "C:\Users\<ユーザー名>\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tellopy\examples\joystick_and_video.py", line 191, in handler
    video_player = Popen(['mplayer', '-fps', '35', '-'], stdin=PIPE)
  File "C:\Users\<ユーザー名>\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "C:\Users\<ユーザー名>\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] 指定されたファイルが見つかりません。

対応方法

mplayer を導入する。

下記URLを開き mplayer-svn-38119-x86_64.7z をダウンロードして展開して mplayer.exe があるフォルダにパスを通す

http://mplayerwin.sourceforge.net/downloads.html

動いたところ

video_effect

joystick_and_video

5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6