I get this error when uploading a file with the ftplib via storbinary method after retrieving a file via retr method.

Why does it happen and how can I fix it?

Recommended Answers

All 2 Replies

NoneType usually means you are trying to use a variable that has not been defined. Without code and the error message it is impossible to tell anything at all.

Well, I already solved it. It was because I called a ftp close(), so when I tried to connect again, it couldn't be done (it says in the wiki of ftplib). So, I eliminated all ftp.close() and added one with the atexit function. Now it works perfectly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.