python problam子进程前擦脚本bash

时间:2016-09-10 08:41:13

标签: python

我在子进程中遇到问题 我有这个脚本bash哪个好工作,名字是kamel.sh

to=$1
subject=$1
/root/Desktop/telegram/tg/bin/./telegram-cli -k /root/Desktop/telegram/tg/tg-server.pub -WR -e "msg $to $subject"

但我想使用python fore work.is 1.sh给2 argv前工作和argv1 = user和argv2 =你好 但是有问题

import subprocess
subprocess.call("1.sh", user, hello, shell=True )

我看到这个eroore

Traceback (most recent call last):
File "/root/Desktop/telegram-log/kamel.py", line 27, in <module>
subprocess.call("kamel.sh testt",kol,shell=True )
File "/usr/lib/python2.7/subprocess.py", line 523, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 660, in __init__
raise TypeError("bufsize must be an integer")
TypeError: bufsize must be an integer

1 个答案:

答案 0 :(得分:0)

import subprocess
subprocess.call("1.sh user hello", shell=True)

import subprocess
subprocess.call(["1.sh", "user", "hello"])