Problem: I keep getting this error when I press the button to trigger Publish from 2nd time and on.

AttributeError: 'NoneType' has no attribute 'sendall'

The error is caused basically by every server.(any ftp host action)
I say this because the function the button called said:


Then I changed that line to the function to connect to the server (that initializes automatically) because I thought the error was caused because we asked the server to go to the directory it was already in, but later, the error said that was caused by:

server.storbinary blah blah blah

So I don't really know what is happening.

Without seeing the code, I'm just guessing. But that error often happens when a method mistakenly assigns a None return value to the object that called it. Here's an example:

>>> mylist = [3,1,2]
>>> mylist = mylist.sort()
>>> len(mylist)

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
TypeError: object of type 'NoneType' has no len()
>>> #  Whaaa...?

The problem is that .sort() operates directly on the mutable list mylist, and returns None. So the fatal line

mylist = mylist.sort()

causes mylist to become None.

So I don't know, but I'm guessing, that somewhere in there, you assign server or blogfiledir to None by mistake.


No problem. I solved it. I don't remember the solution though, but What I did is that I put a connect function at the beginning of the app, and a disconnect one with the atexit. That solved my problem.

This article has been dead for over six months. Start a new discussion instead.