ftplib acting weird

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Merrigan

    #1

    ftplib acting weird

    Hi All,

    I have written a little script to upload some files to an ftp folder.
    The problem is as follows :

    I wrote the script on my windows laptop, and I want to run it from
    mylinux server. Everything worked fine so I uploaded it to my linux
    machine. Every time I tun the script I get the following error:

    *************** *************** *************** *************** *************** *************** *************** *************** ***

    [root@moses ftpsync]# python ftpsync.py
    !!!!!!!!!!
    The Connection to the Server Could not be established.
    Please Check all neccesary settings and run the script again.
    Thank you
    !!!!!!!!!!
    Traceback (most recent call last):
    File "ftpsync.py ", line 194, in ?
    ftplisting()
    File "ftpsync.py ", line 83, in ftplisting
    ftpconn.cwd(rem otedir) #This changes to the remote directory
    File "/usr/lib64/python2.4/ftplib.py", line 494, in cwd
    return self.voidcmd(cm d)
    File "/usr/lib64/python2.4/ftplib.py", line 245, in voidcmd
    self.putcmd(cmd )
    File "/usr/lib64/python2.4/ftplib.py", line 175, in putcmd
    self.putline(li ne)
    File "/usr/lib64/python2.4/ftplib.py", line 170, in putline
    self.sock.senda ll(line)
    AttributeError: 'NoneType' object has no attribute 'sendall'
    [root@moses ftpsync]#

    *************** *************** *************** *************** *************** *************** *************** *************** ***

    When I copy the same piece of scripting and run it from the python
    command shell, it works...

    what am I doing wrong? I have double checked everything about a
    million times, but to no avail.

    Blessings!

  • Carlos Hanson

    #2
    Re: ftplib acting weird

    On May 4, 3:43 am, Merrigan <charl.loub...@ gmail.comwrote:
    Hi All,
    >
    I have written a little script to upload some files to an ftp folder.
    The problem is as follows :
    >
    I wrote the script on my windows laptop, and I want to run it from
    mylinux server. Everything worked fine so I uploaded it to my linux
    machine. Every time I tun the script I get the following error:
    >
    *************** *************** *************** *************** *************** *************** *************** *************** ***
    >
    [root@moses ftpsync]# python ftpsync.py
    !!!!!!!!!!
    The Connection to the Server Could not be established.
    Please Check all neccesary settings and run the script again.
    Thank you
    !!!!!!!!!!
    Traceback (most recent call last):
    File "ftpsync.py ", line 194, in ?
    ftplisting()
    File "ftpsync.py ", line 83, in ftplisting
    ftpconn.cwd(rem otedir) #This changes to the remote directory
    File "/usr/lib64/python2.4/ftplib.py", line 494, in cwd
    return self.voidcmd(cm d)
    File "/usr/lib64/python2.4/ftplib.py", line 245, in voidcmd
    self.putcmd(cmd )
    File "/usr/lib64/python2.4/ftplib.py", line 175, in putcmd
    self.putline(li ne)
    File "/usr/lib64/python2.4/ftplib.py", line 170, in putline
    self.sock.senda ll(line)
    AttributeError: 'NoneType' object has no attribute 'sendall'
    [root@moses ftpsync]#
    >
    *************** *************** *************** *************** *************** *************** *************** *************** ***
    >
    When I copy the same piece of scripting and run it from the python
    command shell, it works...
    >
    what am I doing wrong? I have double checked everything about a
    million times, but to no avail.
    >
    Blessings!
    Can you show the code?

    --
    Carlos Hanson

    Comment

    Working...