ftplib acting weird

Discussion in 'Python' started by Merrigan, May 4, 2007.

  1. Merrigan

    Merrigan Guest

    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(remotedir) #This changes to the remote directory
    File "/usr/lib64/python2.4/ftplib.py", line 494, in cwd
    return self.voidcmd(cmd)
    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(line)
    File "/usr/lib64/python2.4/ftplib.py", line 170, in putline
    self.sock.sendall(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!
     
    Merrigan, May 4, 2007
    #1
    1. Advertisements

  2. On May 4, 3:43 am, Merrigan <> wrote:
    > 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(remotedir) #This changes to the remote directory
    > File "/usr/lib64/python2.4/ftplib.py", line 494, in cwd
    > return self.voidcmd(cmd)
    > 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(line)
    > File "/usr/lib64/python2.4/ftplib.py", line 170, in putline
    > self.sock.sendall(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
     
    Carlos Hanson, May 7, 2007
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David
    Replies:
    5
    Views:
    516
    Juan T. Llibre
    Apr 21, 2005
  2. Gabriel B.

    scope acting weird

    Gabriel B., May 1, 2005, in forum: Python
    Replies:
    1
    Views:
    470
    Mike Meyer
    May 1, 2005
  3. Imran Sadat
    Replies:
    4
    Views:
    553
    Imran
    Jan 11, 2008
  4. Bakes

    Odd/Weird errors with FTPLib

    Bakes, Sep 13, 2009, in forum: Python
    Replies:
    6
    Views:
    521
    Bakes
    Sep 15, 2009
  5. Westly Ward

    Python acting weird

    Westly Ward, Jul 26, 2010, in forum: Python
    Replies:
    0
    Views:
    323
    Westly Ward
    Jul 26, 2010
  6. James N

    MobileCheckbox control acting weird

    James N, Feb 16, 2004, in forum: ASP .Net Mobile
    Replies:
    0
    Views:
    175
    James N
    Feb 16, 2004
  7. mark

    ActiveRecord acting weird

    mark, Jan 20, 2006, in forum: Ruby
    Replies:
    0
    Views:
    142
  8. Patrick L.

    Hash acting weird with scRUBYt

    Patrick L., Feb 18, 2009, in forum: Ruby
    Replies:
    5
    Views:
    222
    Rick DeNatale
    Feb 18, 2009
Loading...