#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2006
    Posts
    3
    Rep Power
    0

    Question Can't upload file using ftplib on MacOS X 10.3.9 (Python 2.3)


    Hi, thanks for listening. I have a small, simple script that runs perfectly on Windows under Python 2.3, but I get socket errors on MacOS X in Python 2.3 . The script simply uploads a file to an ftp server. Here it is:

    import socket
    from ftplib import FTP

    FTPSITE = 'nyx10.nyx.net'
    USER = 'liquid333'
    PW = '**********'


    try:
    import os.path
    import os


    ftp = FTP(FTPSITE) # connect to host, default port
    ftp.set_debuglevel(2)
    ftp.login(USER,PW)

    ftp.cwd("~/html")
    f = open("erase.py", "rb")
    try:
    ftp.storbinary("STOR erase.py", f)
    except socket.error, e:
    print "socket error", e
    except:
    print "something else"
    f.close()
    except:
    print "except"
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Originally Posted by liquid333
    Hi, thanks for listening. I have a small, simple script that runs perfectly on Windows under Python 2.3, but I get socket errors on MacOS X in Python 2.3 . The script simply uploads a file to an ftp server. Here it is:

    python Code:
    import socket
    from ftplib import FTP
     
    FTPSITE = 'nyx10.nyx.net'
    USER = 'liquid333'
    PW = '**********'
     
     
    try:
    	import os.path
    	import os
     
     
    	ftp = FTP(FTPSITE)   # connect to host, default port
    	ftp.set_debuglevel(2)
    	ftp.login(USER,PW)
     
    	ftp.cwd("~/html")
    	f = open("erase.py", "rb")
    	try:
    		ftp.storbinary("STOR erase.py", f)
    	except socket.error, e:
    		print "socket error", e
    	except:
    		print "something else"
    	f.close()
    except:
    	print "except"
    I don't see that there should be any problems with the script, do you have a firewall blocking it? Maybe you could post the error for us, is it getting caught in the socket.error clause?

    Oh, also use code tags in the future to preserve indentation . You can get details of this in the how to post a question thread at the top of this forum.

    Take care .

    Mark.
    programming language development: www.netytan.com Hula

  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2006
    Posts
    3
    Rep Power
    0
    Originally Posted by netytan
    I don't see that there should be any problems with the script, do you have a firewall blocking it? Maybe you could post the error for us, is it getting caught in the socket.error clause?

    Oh, also use code tags in the future to preserve indentation . You can get details of this in the how to post a question thread at the top of this forum.

    Take care .

    Mark.
    The exact error message (sorry for forgetting to include this) is (61, 'Connection refused'). It is possible it is behind a firewall, I guess. Although I'm not aware of the firewall. There is no special firewall software (installed). I can't say if Mac OS X is running its own firewall. Doubtfull that it is the firewall in the router, because I have the same router in the same configuration on my Windows PC.

    Thanks,

    liquid

IMN logo majestic logo threadwatch logo seochat tools logo