TypeError: execv() arg 2 must contain only strings

前端 未结 2 1708
故里飘歌
故里飘歌 2021-01-04 00:23

I am getting the following error when running the script below,can anyhelp to identify what the problem is and how to overcome it

import subprocess
import sy         


        
2条回答
  •  悲&欢浪女
    2021-01-04 00:38

    First you need to add the quotes around 29418 as mgilson mentioned. Second let's break down what you're trying to run:

    ssh_command = ["ssh", "-p", 29418, "review-android.company.com", "gerrit",
                   "query", "--format", "JSON", "--current-patch-set",
                   "--commit-message", "--files", ]
    

    That equals

    ssh -p 29418 review-android.company.com gerrit query --format JSON --current-patch-set --commit-message --files
    (then I'm assuming you have filenames in your caf_gerrits.txt file which get appended at the end)
    

    One thing that pops out at me is that you may want to say --format=JSON in which case your elements in the ssh_command array should be combined as [..., "--format=JSON", ...]. The other thing you may want to do is print result after your result= line to help with the debugging.

提交回复
热议问题