Pass integer input argument for Popen.communicate()

前端 未结 3 487
走了就别回头了
走了就别回头了 2021-01-26 11:04

I am pretty new to python and I am stuck with something now. I am using python 2.7. I am trying to automate a command in shell for which I wrote a python script. I have to input

3条回答
  •  天命终不由人
    2021-01-26 11:32

    The ./sbt process you are calling needs to be able to read a string and convert it into a integer. It is not possible to send native Python types to a child process with only Popen.

    Another potential solution would be to serialize the data into JSON, YAML, XML, python pickle format, etc - choose your standard. However as you are passing a single integer this would seem very much overkill.

提交回复
热议问题