user547907
user547907

Reputation:

error while importing ftplib

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

Upvotes: 0

Views: 405

Answers (2)

Mattie B
Mattie B

Reputation: 21269

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.

Upvotes: 1

defuz
defuz

Reputation: 27581

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

Upvotes: 0

Related Questions