ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.73k stars 10.07k forks source link

Do we need http.server as dependency? #26343

Closed dano6 closed 4 years ago

dano6 commented 4 years ago

Checklist

Question

Hello guys, I am trying to use youtube-dl in Ubuntu Touch project. Importing http.server is causing sandbox violations and throws a phyton error. Can we edit this https://github.com/ytdl-org/youtube-dl/blob/master/youtube_dl/compat.py#L2358 4 lines of code that http.server wouldn't be compulsory? I was looking that it is used just for tests. I am not a python coder, so I am not sure how to write correct MR. Thanks for the answer.

dano6 commented 4 years ago

This is complete error, ideal would be get '/etc/mime.types' out of sandbox, but it will complicate things for me

"PyOtherSide error: Traceback (most recent call last):\n\n  File \"qrc:/Qml//ytdl_wrapper.py\", line 6, in <module>\n    import youtube_dl\n\n  File \"/opt/click.ubuntu.com/quickddit/0.9/youtube_dl/__init__.py\", line 15, in <module>\n    from .options import (\n\n  File \"/opt/click.ubuntu.com/quickddit/0.9/youtube_dl/options.py\", line 8, in <module>\n    from .downloader.external import list_external_downloaders\n\n  File \"/opt/click.ubuntu.com/quickddit/0.9/youtube_dl/downloader/__init__.py\", line 3, in <module>\n    from .common import FileDownloader\n\n  File \"/opt/click.ubuntu.com/quickddit/0.9/youtube_dl/downloader/common.py\", line 9, in <module>\n    from ..compat import compat_os_name\n\n  File \"/opt/click.ubuntu.com/quickddit/0.9/youtube_dl/compat.py\", line 2359, in <module>\n    import http.server as compat_http_server\n\n  File \"/usr/lib/python3.5/http/server.py\", line 628, in <module>\n    class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):\n\n  File \"/usr/lib/python3.5/http/server.py\", line 836, in SimpleHTTPRequestHandler\n    mimetypes.init() # try to read system mime.types\n\n  File \"/usr/lib/python3.5/mimetypes.py\", line 353, in init\n    db.read(file)\n\n  File \"/usr/lib/python3.5/mimetypes.py\", line 202, in read\n    with open(filename, encoding='utf-8') as fp:\n\nPermissionError: [Errno 13] Permission denied: '/etc/mime.types'\n"
qml: python error: Cannot import module: ytdl_wrapper (Traceback (most recent call last):

  File "qrc:/Qml//ytdl_wrapper.py", line 6, in <module>
    import youtube_dl

  File "/opt/click.ubuntu.com/quickddit/0.9/youtube_dl/__init__.py", line 15, in <module>
    from .options import (

  File "/opt/click.ubuntu.com/quickddit/0.9/youtube_dl/options.py", line 8, in <module>
    from .downloader.external import list_external_downloaders

  File "/opt/click.ubuntu.com/quickddit/0.9/youtube_dl/downloader/__init__.py", line 3, in <module>
    from .common import FileDownloader

  File "/opt/click.ubuntu.com/quickddit/0.9/youtube_dl/downloader/common.py", line 9, in <module>
    from ..compat import compat_os_name

  File "/opt/click.ubuntu.com/quickddit/0.9/youtube_dl/compat.py", line 2359, in <module>
    import http.server as compat_http_server

  File "/usr/lib/python3.5/http/server.py", line 628, in <module>
    class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):

  File "/usr/lib/python3.5/http/server.py", line 836, in SimpleHTTPRequestHandler
    mimetypes.init() # try to read system mime.types

  File "/usr/lib/python3.5/mimetypes.py", line 353, in init
    db.read(file)

  File "/usr/lib/python3.5/mimetypes.py", line 202, in read
    with open(filename, encoding='utf-8') as fp:

PermissionError: [Errno 13] Permission denied: '/etc/mime.types'
)
dstftw commented 4 years ago

You can though it will break tests.