0

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.

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by Racoon200
0

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

0

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 topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.