Question

I get this while running the code which worked some time ago. i tried to change import options aka from ftplib import *, etc, but no luck. Any help appreciated...

C:\blahblahblah>python ftp_client.py
Traceback (most recent call last):
  File "ftp_client.py", line 8, in <module>
    from ftplib import FTP
  File "C:\blahblahblah\ftplib.py", line 1
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtm
l11/DTD/xhtml11.dtd">
    ^
SyntaxError: invalid syntax
Was it helpful?

Solution

Your copy of ftplib.py, which you have downloaded off the Web and placed in the same directory of your script (which is the first place Python searches for modules by default), is actually HTML, not Python source.

You should not need your own ftplib.py, since ftplib is in the standard library. Delete it and I suspect your script will work just fine.

OTHER TIPS

You try to import C:\blahblahblah\ftplib.py file, which contains html code. I think it isn't what you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top