def ftp_login(folder=None):
pwDir=os.path.realpath(__file__)<EOL>for i in range(<NUM_LIT:3>):<EOL><INDENT>pwDir=os.path.dirname(pwDir)<EOL><DEDENT>pwFile = os.path.join(pwDir,"<STR_LIT>")<EOL>print("<STR_LIT>"%pwFile)<EOL>try:<EOL><INDENT>with open(pwFile) as f:<EOL><INDENT>lines=f.readlines()<EOL><DEDENT>username=lines[<NUM_LIT:0>].strip()<EOL>password=lines[<NUM_LIT:1>].strip()<EOL>print("<STR_LIT>")<EOL><DEDENT>except:<EOL><INDENT>print("<STR_LIT>")<EOL>username=TK_askPassword("<STR_LIT>","<STR_LIT>")<EOL>password=TK_askPassword("<STR_LIT>","<STR_LIT>"%username)<EOL>if not username or not password:<EOL><INDENT>print("<STR_LIT>")<EOL>return<EOL><DEDENT><DEDENT>print("<STR_LIT>",username)<EOL>print("<STR_LIT>","<STR_LIT:*>"*(len(password)))<EOL>print("<STR_LIT>")<EOL>try:<EOL><INDENT>ftp = ftplib.FTP("<STR_LIT>")<EOL>ftp.login(username, password)<EOL>if folder:<EOL><INDENT>ftp.cwd(folder)<EOL><DEDENT>return ftp<EOL><DEDENT>except:<EOL><INDENT>print("<STR_LIT>")<EOL>return False<EOL><DEDENT>
return an "FTP" object after logging in.