FTP problem.
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.
Racoon200
Junior Poster in Training
68 posts since Nov 2006
Reputation Points: 13
Solved Threads: 1
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
jrcagle
Practically a Master Poster
608 posts since Jul 2006
Reputation Points: 92
Solved Threads: 156
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.
Racoon200
Junior Poster in Training
68 posts since Nov 2006
Reputation Points: 13
Solved Threads: 1