TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: ROBH
from: RICHARD KETTLEWELL
date: 2018-05-15 20:30:00
subject: Re: ftp causing invalid s

RobH  writes:
> On 14/05/18 22:20, mm0fmf wrote:
>> Well curl is a program not a Python method. So you have to tell
>> Python to execute curl with os.system() or similar or you can use
>> the curl library pycurl or use ftplib. An example for Python2 on
>> Windows, edit to fit.
>>
>> import ftplib
>> from ftplib import FTP
>>
>> File2Send = "V://GIS//Maps//County//11x17shd//2010BEAVER11x17shd.pdf"
>> Output_Directory = "//data2//ftp//pub//download//maps//"
>>
>> try:
>>      ftp = FTP("XXX.XXX.XXX.XXX")
>>      ftp.login(username, password)
>>      file = open(File2Send, "rb")
>>      ftp.cwd(Output_Directory)
>>      ftp.storbinary('STOR ' + File2Send, file)
>>      print "STORing File now..."
>>      ftp.quit()
>>      file.close()
>>      print "File transfered"
>> else:
>>      print "An error occured"
>>
>>
>> See https://community.esri.com/thread/16333
>>
>>
> Thanks for the above but when I use import ftplib, it returns
> bash: import: command not found.

You ran the script with Bash instead of Python, then.

Perhaps this would go more smoothly if you learned some Python?

--
https://www.greenend.org.uk/rjk/

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.