小编cyr*_*ram的帖子

Python Popen无法找到指定的文件

我有以下代码

pathToFile = "R:\T2 Output\12345--01--Some File 1--ABCD.mp4"
process = subprocess.Popen(['ffprobe.exe', '-show_streams', '"'+pathToFile+'"'],
    shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Run Code Online (Sandbox Code Playgroud)

我收到错误:

[Error 2] The system cannot find the file specified
Run Code Online (Sandbox Code Playgroud)

我尝试过的:

  • 将shell更改为True = shell = False
  • 将命令组合成单个字符串而不是使用列表(我甚至将其打印到屏幕,我可以复制并粘贴到文件运行的命令提示符中并提供预期的输出(无错误)
  • 我确保ffprobe.exe位于PATH中,可以从命令行执行而无需指定目录

注意事项:

  • 该文件位于映射的网络驱动器(R)上
  • 该文件在文件名中有空格,这就是我用引号括起来的原因.

我确定我错过了一些简单的事情.谁能指出我正确的方向?我已经在这个网站和其他人上做了很多搜索并尝试了一些建议.

python subprocess popen

8
推荐指数
1
解决办法
4786
查看次数

Cognito身份池授权/未授权角色的Terraform定义

我一直在尝试创建一个Terraform脚本来创建具有链接的auth和unauth角色的cognito用户池和身份池,但是我找不到一个很好的例子。这是我到目前为止的内容:

cognito.tf:

resource "aws_cognito_user_pool" "pool" {
     name = "Sample User Pool"
     admin_create_user_config {
          allow_admin_create_user_only = false
     }

     /* More stuff here, not included*/
 }

 resource "aws_cognito_user_pool_client" "client" {
      name = "client"
      user_pool_id = "${aws_cognito_user_pool.pool.id}"

      generate_secret = true
      explicit_auth_flows = ["ADMIN_NO_SRP_AUTH"]
 }

 resource "aws_cognito_identity_pool" "main" {
      identity_pool_name               = "SampleIdentityPool"
      allow_unauthenticated_identities = false

      cognito_identity_providers {
           client_id               = "${aws_cognito_user_pool_client.id}"
           provider_name           = ""
           server_side_token_check = true
      }
 }
Run Code Online (Sandbox Code Playgroud)

因此,我想为此添加一个auth角色和一个unauth角色,但我仍在设法了解如何在terraform中定义和链接IAM角色,但这是到目前为止的内容:

 resource "aws_cognito_identity_pool_roles_attachment" "main" {
      identity_pool_id = "${aws_cognito_identity_pool.main.id}"

      roles {
           "authenticated"   = <<EOF
           {
                actions = …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services amazon-iam amazon-cognito terraform

5
推荐指数
1
解决办法
975
查看次数