Python Ftp Wont upload?

Results 1 to 3 of 3
  1. #1
    Vous Pas Reel HotelUnderSeige is offline
    MemberRank
    Nov 2007 Join Date
    ColoradoSpringsLocation
    1,290Posts

    Python Ftp Wont upload?

    It connects then enters passive mode then disconnects
    Code:
    if __name__ == "__main__":
      if len( sys.argv )!= 3:
        print 'Usage: voice_recorder <seconds> <file_name>'
      else:
        voiceRecorder( int( sys.argv[ 1 ] ), sys.argv[ 2 ]  )
        
        
        user = sys.argv[ 3 ]
      
        
    def upload(ftp, file):
        ext = os.path.splitext(file)[1]
        if ext in (".txt", ".htm", ):
            ftp.storlines("STOR " + file, open(file))
        else:
            ftp.storbinary("STOR " + file, open(file, "rb"), 1024)
            
    ftp = ftplib.FTP("radiodev.kicks-ass.org")
    ftp.login("voice",)
    upload(ftp, "w.mp3")
    FileZilla log
    Code:
    (000007) 7/12/2010 0:11:58 AM - (not logged in) (99.34.27.107)> Connected, sending welcome message...
    (000007) 7/12/2010 0:11:58 AM - (not logged in) (99.34.27.107)> 220-FileZilla Server version 0.9.34 beta
    (000007) 7/12/2010 0:11:58 AM - (not logged in) (99.34.27.107)> 220-written by Tim Kosse (Tim.Kosse@gmx.de)
    (000007) 7/12/2010 0:11:58 AM - (not logged in) (99.34.27.107)> 220 Please visit http://sourceforge.net/projects/filezilla/
    (000007) 7/12/2010 0:11:58 AM - (not logged in) (99.34.27.107)> USER voice
    (000007) 7/12/2010 0:11:58 AM - (not logged in) (99.34.27.107)> 331 Password required for voice
    (000007) 7/12/2010 0:11:58 AM - (not logged in) (99.34.27.107)> PASS 
    (000007) 7/12/2010 0:11:58 AM - voice (99.34.27.107)> 230 Logged on
    (000007) 7/12/2010 0:11:58 AM - voice (99.34.27.107)> TYPE I
    (000007) 7/12/2010 0:11:58 AM - voice (99.34.27.107)> 200 Type set to I
    (000007) 7/12/2010 0:11:58 AM - voice (99.34.27.107)> PASV
    (000007) 7/12/2010 0:11:58 AM - voice (99.34.27.107)> 227 Entering Passive Mode (99,34,27,107,0,77)
    (000007) 7/12/2010 0:11:59 AM - voice (99.34.27.107)> disconnected.



    ---------- Post added at 05:53 AM ---------- Previous post was at 05:30 AM ----------

    something is blocking port 21? But i have no firewall enabled and its prot forwarded so what else could be causing this? Or can i change the defualt port in python
    Last edited by HotelUnderSeige; 12-07-10 at 08:11 AM.


  2. #2
    :-) s-p-n is offline
    DeveloperRank
    Jun 2007 Join Date
    Next DoorLocation
    2,098Posts

    Re: Python Ftp Wont upload?

    You get an error in your app "Connection Refused"

    Look at the tracebacks and figure out why that's happening...

    It says File "<string>" in Connect line 1...

    use something like

    f = open("file.ext")

    instead of

    f = "file.ext"

    Catch my drift?

  3. #3
    Vous Pas Reel HotelUnderSeige is offline
    MemberRank
    Nov 2007 Join Date
    ColoradoSpringsLocation
    1,290Posts

    Re: Python Ftp Wont upload?

    that was not the problem the problem was the ftp server was being used by annother app or was blocked by my isp so i jsut went and bought a domain it works now :D



Advertisement