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

On 14/05/18 20:42, mm0fmf wrote:
> 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.
>
>
>
>
>
>
>
Thanks, but when the python script runs without the inserted curl line,
it takes pictures of whatever is sensed and writes the actual file to
the sdcard.

I read somewhere that writing to the Pizero sdcard so many times, as it
would, is not a could idea as it could be corrupted.

So I looked for a way to upload the jpg file to my server.

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