Why I get "PermissionError: [WinError 5] Access is denied" error when I using youtube-dl in c# process class?

Why I get "PermissionError: [WinError 5] Access is denied" error when I using youtube-dl in c# process class?

当我 运行 youtube-dl.exe 在服务器上使用 c# 进程 class 时,它 returns 在 StandardOutput 中出现以下错误:

Traceback (most recent call last):
  File "__main__.py", line 19, in <module>
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpc7h_sle1\build\youtube_dl\__init__.py", line 449, in main
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpc7h_sle1\build\youtube_dl\__init__.py", line 416, in _real_main
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpc7h_sle1\build\youtube_dl\YoutubeDL.py", line 367, in __init__
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpc7h_sle1\build\youtube_dl\YoutubeDL.py", line 2100, in _setup_opener
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpc7h_sle1\build\youtube_dl\utils.py", line 642, in make_HTTPS_handler
  File "C:\Python\Python34\lib\ssl.py", line 439, in create_default_context
  File "C:\Python\Python34\lib\ssl.py", line 390, in load_default_certs
  File "C:\Python\Python34\lib\ssl.py", line 377, in _load_windows_store_certs
PermissionError: [WinError 5] Access is denied

这些错误是什么?我没有这些路径和包含这些目录的文件。 这是我的代码

   string ydlPath = Server.MapPath("/ydlPath/youtube-dl.exe");
    string tempLocation = Server.MapPath("/ydlPath/");

    System.IO.StreamReader errorreader;
    System.Diagnostics.Process proc = new System.Diagnostics.Process();
    proc.EnableRaisingEvents = false;
    proc.StartInfo.ErrorDialog = false;
    proc.StartInfo.RedirectStandardError = true;
    proc.StartInfo.FileName = ydlPath ;
    //proc.StartInfo.Arguments = "-F \"" + Url + "\"";
    proc.StartInfo.WorkingDirectory = tempLocation;
    proc.StartInfo.Arguments = "-f bestvideo[ext=mp4]+bestaudio[ext=m4a] \"" + Url + "\"";
    proc.StartInfo.Verb = "runas";
    proc.StartInfo.UseShellExecute = false;
    proc.StartInfo.CreateNoWindow = false;
    proc.StartInfo.RedirectStandardOutput = true;
    proc.Start();
    errorreader = proc.StandardError;
    string Output = proc.StandardOutput.ReadToEnd();

    proc.WaitForExit();
    proc.Close();

我在本地用过这个,效果很好。 另外,当我在服务器或本地上使用youtube-dl.exe with cmd时,我没有问题。

How can I solve this problem? Anyone can help me?

此问题已解决,此问题与 python bug.Details 相关,存在于:https://github.com/rg3/youtube-dl/issues/10766