[英]Subprocess.check_output doesn't work
When I use the check_output within the Subprocess module I have this output error from the Python shell: 当我在Subprocess模块中使用check_output时,我从Python shell获得了这个输出错误:
AttributeError: 'module' object has no attribute 'check_output'
AttributeError:'module'对象没有属性'check_output'
The code: 编码:
target = raw_input("IP: ")
port = subprocess.check_output(["python", "portscanner.py", target ])
I use Python 2.7. 我使用Python 2.7。 Thanks for the solution!
谢谢你的解决方案!
check_output() method is defined in python2.7 onwards, as said by "Martijn Pieters" check_output()方法在python2.7开始定义,如“Martijn Pieters”所述
check in subprocess.py line no: 515 检查subprocess.py行号:515
def check_output(*popenargs, **kwargs):
you may either be using the old python version or you might have messed up with the python interpreter. 您可能正在使用旧的python版本,或者您可能已经搞砸了python解释器。
try using 尝试使用
dir(module[.class])
to find the available methods or classes in any module and proceed. 在任何模块中查找可用的方法或类并继续。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.