Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 908
Black_Ram Avatar asked Jul 12 '26 19:07

Black_Ram


1 Answers

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.

like image 178
Siva Cn Avatar answered Jul 14 '26 08:07

Siva Cn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!