0

Hi,
I'm a newbie to Python and trying to write my first FTP script. Here's the code:

from ftplib import FTP
ftp = FTP("LoginServer.com")  
ftp.login("LoginID", "Password")
# open the file to read it
f = open("C:/Users/MyDocs/Documents/Python/test.txt", "r")
# Open directory
ftp.cwd("/")
# save file 
ftp.storbinary("STOR test.txt", f)
ftp.quit()
f.close()

I'm getting this error:

Traceback (most recent call last):
  File "C:\Users\MyDocs\Documents\Python\FTP-Real.py", line 3, in <module>
    ftp.login("LoginID", "Password")
  File "C:\Python32\lib\ftplib.py", line 396, in login
    if resp[0] == '3': resp = self.sendcmd('PASS ' + passwd)
  File "C:\Python32\lib\ftplib.py", line 255, in sendcmd
    return self.getresp()
  File "C:\Python32\lib\ftplib.py", line 229, in getresp
    raise error_perm(resp)
ftplib.error_perm: 530 User UserID cannot log in, home directory inaccessible.

Is this a permissions issue with the target root folder and I need some special access rights to it?

Any help will be greatly appreciated as I'm new to Python.

2
Contributors
1
Reply
4
Views
4 Years
Discussion Span
Last Post by pyTony
0

You specify path relative path relative to ftp root directory, you have Windows file path specified. Check first that the ftp you try works from command line ftp, before trying to do it with ftplib.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.