FTP problem.

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2006
Posts: 66
Reputation: Racoon200 is an unknown quantity at this point 
Solved Threads: 1
Racoon200's Avatar
Racoon200 Racoon200 is offline Offline
Junior Poster in Training

FTP problem.

 
0
  #1
Jan 19th, 2008
Problem: I keep getting this error when I press the button to trigger Publish from 2nd time and on.
Error:
  1. 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:
  1. 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:
  1. server.storbinary blah blah blah

So I don't really know what is happening.
_______
woli
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 608
Reputation: jrcagle is on a distinguished road 
Solved Threads: 150
jrcagle jrcagle is offline Offline
Practically a Master Poster

Re: FTP problem.

 
0
  #2
Jan 21st, 2008
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:

  1. >>> mylist = [3,1,2]
  2. >>> mylist = mylist.sort()
  3. >>> len(mylist)
  4.  
  5. Traceback (most recent call last):
  6. File "<pyshell#2>", line 1, in <module>
  7. len(mylist)
  8. TypeError: object of type 'NoneType' has no len()
  9. >>> # 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
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 66
Reputation: Racoon200 is an unknown quantity at this point 
Solved Threads: 1
Racoon200's Avatar
Racoon200 Racoon200 is offline Offline
Junior Poster in Training

Re: FTP problem.

 
0
  #3
Jan 22nd, 2008
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.
_______
woli
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC