jaimeMF / youtube-dl-api-server

A youtube-dl REST API server
https://youtube-dl-api-server.readthedocs.org/
The Unlicense
364 stars 214 forks source link

GAE error: AttributeError: 'module' object has no attribute 'Popen' #30

Closed ping closed 9 years ago

ping commented 9 years ago

My setup OSX 10.9.5. I ran ./devscripts/setup-gae.sh

Downloading python packages
Downloading/unpacking youtube-dl>=2014.03.12 (from -r ./gae/gae_requirements.txt (line 1))
  Using download cache from ./gae/tmp/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fy%2Fyoutube_dl%2Fyoutube_dl-2015.05.04.tar.gz
  Running setup.py egg_info for package youtube-dl

Requirement already up-to-date: flask in /Library/Python/2.7/site-packages (from -r ./gae/gae_requirements.txt (line 2))
Downloading/unpacking Werkzeug>=0.7 from https://pypi.python.org/packages/source/W/Werkzeug/Werkzeug-0.10.4.tar.gz#md5=66a488e0ac50a9ec326fe020b3083450 (from flask->-r ./gae/gae_requirements.txt (line 2))
  Using download cache from ./gae/tmp/cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2FW%2FWerkzeug%2FWerkzeug-0.10.4.tar.gz
  Running setup.py egg_info for package Werkzeug

    no previously-included directories found matching 'docs/_build'
    no previously-included directories found matching 'docs/_themes'
    warning: no previously-included files matching '*.py[cdo]' found anywhere in distribution
    warning: no previously-included files matching '__pycache__' found anywhere in distribution
    warning: no previously-included files matching '*.so' found anywhere in distribution
    warning: no previously-included files matching '*.pyd' found anywhere in distribution
Requirement already up-to-date: Jinja2>=2.4 in /Library/Python/2.7/site-packages (from flask->-r ./gae/gae_requirements.txt (line 2))
Requirement already up-to-date: itsdangerous>=0.21 in /Library/Python/2.7/site-packages (from flask->-r ./gae/gae_requirements.txt (line 2))
Requirement already up-to-date: markupsafe in /Library/Python/2.7/site-packages (from Jinja2>=2.4->flask->-r ./gae/gae_requirements.txt (line 2))
Successfully downloaded youtube-dl Werkzeug
Copying python packages to ./gae/lib
cp: ./gae/build/flask/flask: No such file or directory
cp: ./gae/build/itsdangerous/itsdangerous.py: No such file or directory
Patching youtube_dl

I got a bunch of import errors for flask and itsdangerous and I had to separately download flask and itsdangerous and copy them into ./gae/lib/ before it sorta worked.

When I tried to test the /api/info endpoint, I got a server 500 error. The stack trace:

ERROR    2015-05-07 04:49:16,481 app.py:1423] Exception on /api/info [GET]
Traceback (most recent call last):
  File "/Users/ping/PycharmProjects/youtube-dl-api-server/gae/lib/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/ping/PycharmProjects/youtube-dl-api-server/gae/lib/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/ping/PycharmProjects/youtube-dl-api-server/gae/lib/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/ping/PycharmProjects/youtube-dl-api-server/gae/lib/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/ping/PycharmProjects/youtube-dl-api-server/gae/lib/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/ping/PycharmProjects/youtube-dl-api-server/youtube_dl_server/app.py", line 60, in wrapper
    response = f(*args, **kargs)
  File "/Users/ping/PycharmProjects/youtube-dl-api-server/youtube_dl_server/app.py", line 78, in info
    result = get_videos(url)
  File "/Users/ping/PycharmProjects/youtube-dl-api-server/youtube_dl_server/app.py", line 34, in get_videos
    res = ydl.extract_info(url, download=False)
  File "/Users/ping/PycharmProjects/youtube-dl-api-server/gae/lib/youtube_dl/YoutubeDL.py", line 661, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/Users/ping/PycharmProjects/youtube-dl-api-server/gae/lib/youtube_dl/YoutubeDL.py", line 707, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/Users/ping/PycharmProjects/youtube-dl-api-server/gae/lib/youtube_dl/YoutubeDL.py", line 1089, in process_video_result
    if info_dict['extractor'] in ['youtube', 'ted'] and FFmpegMergerPP(self).available:
  File "/Users/ping/PycharmProjects/youtube-dl-api-server/gae/lib/youtube_dl/postprocessor/ffmpeg.py", line 34, in __init__
    self._determine_executables()
  File "/Users/ping/PycharmProjects/youtube-dl-api-server/gae/lib/youtube_dl/postprocessor/ffmpeg.py", line 90, in _determine_executables
    (p, get_exe_version(p, args=['-version'])) for p in programs)
  File "/Users/ping/PycharmProjects/youtube-dl-api-server/gae/lib/youtube_dl/postprocessor/ffmpeg.py", line 90, in <genexpr>
    (p, get_exe_version(p, args=['-version'])) for p in programs)
  File "/Users/ping/PycharmProjects/youtube-dl-api-server/gae/lib/youtube_dl/utils.py", line 1382, in get_exe_version
    out, _ = subprocess.Popen(
AttributeError: 'module' object has no attribute 'Popen'

Any idea what's wrong? Same error on the local devserver and deployed on GAE.

jaimeMF commented 9 years ago

Which git commit are you using? I think with ac0dc2337086dc14c652033727ec83b4920866eb it should work.

ping commented 9 years ago

That fixed it. I was using the tagged release 0.1.2 (Jan 3). I still had to manually copy flask and itsdangerous over, but other than that, it looks good. Thanks!

jaimeMF commented 9 years ago

I still had to manually copy flask and itsdangerous over

I think that happens when you have globally installed them, I should use a virtualenv if that's the case.

jaimeMF commented 9 years ago

With d3c43a067dff0893299c3faffd7ad93621f84cd9 it shouldn't fail when libraries are installed globally.