List Info

Thread: GIS Shape file upload FTP server




GIS Shape file upload FTP server
country flaguser name
United States
2007-03-02 07:39:52
HI Group,


As I am very new in python field so this question might be
very silly
but if I get any help that is highly appreciated.


Problem: 

I wrote a python script which is working fine to upload
files to the ftp
server but the problem it is reducing the actual size of the
after
transferring. I need to upload a GIS Shape file to the ftp
server but
want to keep the same size and format. Any idea or help is
highly
appreciated.

 

Thanks
Shakir
Staff Geographer
Sfwmd.gov


The code is as follows: 
 
# Import system modules
import os
import sys 
import win32com.client
import zipfile
import os.path
import ftplib
from ftplib import FTP

 
ftp=ftplib.FTP("ftp.mysite.*","","&
quot;)  
ftp.login('*****','*****')
#ftp.cwd("/export/pub/****")
ffile = open('c:\test\*.shp', 'r')
ftp.storbinary("stor *.shp", ffile)
ffile.close()
print "OK"
ftp.quit()
_______________________________________________
Python-win32 mailing list
Python-win32python.org

http://mail.python.org/mailman/listinfo/python-win32

Re: GIS Shape file upload FTP server
country flaguser name
Germany
2007-03-02 08:09:49
Ahmed, Shakir schrieb:
> HI Group,
> 
> 
> As I am very new in python field so this question might
be very silly
> but if I get any help that is highly appreciated.
> 
> 
> Problem: 
> 
> I wrote a python script which is working fine to upload
files to the ftp
> server but the problem it is reducing the actual size
of the after
> transferring. I need to upload a GIS Shape file to the
ftp server but
> want to keep the same size and format. Any idea or help
is highly
> appreciated.
> 
>  
> 
> Thanks
> Shakir
> Staff Geographer
> Sfwmd.gov
> 
> 
> The code is as follows: 
>  
> # Import system modules
> import os
> import sys 
> import win32com.client
> import zipfile
> import os.path
> import ftplib
> from ftplib import FTP
> 
>  
>
ftp=ftplib.FTP("ftp.mysite.*","","&
quot;)  
> ftp.login('*****','*****')
> #ftp.cwd("/export/pub/****")
> ffile = open('c:\test\*.shp', 'r')
> ftp.storbinary("stor *.shp", ffile)
> ffile.close()
> print "OK"
> ftp.quit()

On Windows, you have to open binary files in binary mode:

> ffile = open('c:\test\*.shp', 'rb')
                                   ^^
otherwise the file will be truncated at the first ^Z
character.

Thomas

_______________________________________________
Python-win32 mailing list
Python-win32python.org

http://mail.python.org/mailman/listinfo/python-win32

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )