TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: ROBH
from: MM0FMF
date: 2018-05-14 20:42:00
subject: Re: ftp causing invalid s

On 14/05/2018 20:23, RobH wrote:
> I have built a motion sensor detector using this code: from the
> dronebotworkshop on youtube. While it works very well for me, I now want
> to upload the pictures to my NAS server.
> I googled this and found this line of code:
>
> curl -T /home/pi/filename.jpg
> ftp://ftp-host-machine//yourwebsite/folder/filename.jpg --user
>
> Now when I run the python script:
>
>   from picamera import PiCamera
[snip]

> curl -T /home/pi/filename.jpg ftp://ftp-ipaddressof NAS
> server/mnt/folder/filename.jpg --user
> # Wait 25 seconds and repeat
> time.sleep(25)
>
> It returns Invalid syntax at the ftp://ftp- etc
>
>   I can get as far as a login box from my Ubuntu desktop with this:
> ftp://server ip address/mnt/Folder/subfolder, but it fails completely on
> the PiZero with invalid synatx at ftp

curl is not a Python command but an external program. You either need to
use pycurl (a la import pycurl) or you want to get your Python script to
execute the curl program using os.system(....) or similar.

Much more simple would be to use the ftp library included in the
standard Python library and do the ftp yourself. YMMV.

--- 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™.