python ftplib weird behaviour

ftplib, python

Solution

You have a space (`' '`) character in your username field.

Problem

I'm running into some very strange behaviour when trying to connect to a ftp server using ftplib. What I'm doing is: ``` import ftplib ftp = ftplib.FTP('my-ftp-server') ftp.login('user ', 'pass') ``` Now if I run these from a python interpreter it work fine and I get: ``` '230 Login successful.' ``` But I want to have these in a nice script that can do stuff for me. When I put these all in some python script and run: ``` python my_ftp_stuff.py ``` I get: ``` ftplib.error_perm: 530 Login incorrect. ``` I really am clueless as to what can cause this weird behaviour. Does anyone have any tips on what to try? Best regards

Original source