#1
  1. No one Important
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Australia
    Posts
    524
    Rep Power
    14

    Ftp.storlines Question


    Hi all trying to upload a html snippet file from a windows machine to a unix server.

    Basically the code is all working except for when I am sending a ftp.storlines it appears not be sending the complete file......

    This is what I am currently using...
    Code:
    print '*** Changing server dir to: ', PUT_DIR
       ftp.cwd(PUT_DIR)
    
       try:
          print '*** UPLOADING CURRENT SNIPPET: ', PUT_FILENAME
    
          ftp.storlines('STOR ' + PUT_FILENAME,open(LOCAL_FILENAME, 'f'))
          
       except:
         print '*** UNABLE TO UPLOAD FILE'
    When the file is on the windows machine it is complete, however when it ends up on the server it is incomplete, it is like it has only sent three quarters of the file.

    Has anyone got any suggestions that might help?

    Cheeers
  2. #2
  3. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    Hi,

    If you remove the exception handling is an exception raised?

    Does storbinary work as you expect?

    grim

    Comments on this post

    • netytan agrees : I was just wondering this: if the file is binary i.e. an image
  4. #3
  5. No one Important
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Australia
    Posts
    524
    Rep Power
    14
    Originally Posted by Grim Archon
    Hi,

    If you remove the exception handling is an exception raised?

    Does storbinary work as you expect?

    grim
    file is text, i would not want to transfer and binary file.

    I will remove the exception handling and give it a go....
  6. #4
  7. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    file is text, i would not want to transfer and binary file.
    for the purposes of testing storbinary does not look at the contents of the file or do any translation so should not complain if there are unusual characters in the file.

    The possible exception is the first thing to investigate

    grim
  8. #5
  9. No one Important
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Australia
    Posts
    524
    Rep Power
    14
    Yeah I am going to do the exception test to see what error is spitting out, however the machine power supply died over the weekend so its not running at the moment. grrrrrrrr

    gotta get it back up and running as soon as I am able to.

IMN logo majestic logo threadwatch logo seochat tools logo