Black_Ram
Black_Ram

Reputation: 443

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:

AttributeError: 'module' object has no attribute 'check_output'

The code:

target = raw_input("IP: ")
port = subprocess.check_output(["python", "portscanner.py", target ])

I use Python 2.7. Thanks for the solution!

Upvotes: 3

Views: 1132

Answers (1)

Siva Cn
Siva Cn

Reputation: 947

check_output() method is defined in python2.7 onwards, as said by "Martijn Pieters"

check in subprocess.py line no: 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.

try using

dir(module[.class]) 

to find the available methods or classes in any module and proceed.

Upvotes: 1

Related Questions