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

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:

server.cwd(blogfiledir)

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.

Recommended Answers

All 2 Replies

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>
    len(mylist)
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.

Jeff

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.

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.