As a total python beginner with zero experience, I'm trying to make a script that takes a photo with the camera module V2 every x minutes and then uploads it to FTP. So far it's a nightmare and I am breaking the problem(s) down into small segments.
First: the FTP issue. It won't do anything, so I just wanted to see what happens when I execute this small script:
nluug is an anynomous FTP server that is good for testing.
According to the ftplib docs (https://docs.python.org/3/library/ftplib.html) the syntax should be:
When I execute this code on a windows machine running python I get:
WHY?! How do I fix this?
First: the FTP issue. It won't do anything, so I just wanted to see what happens when I execute this small script:
Code:
import ftplibfrom ftplib import FTPsession = ftplib.FTP('ftp.nluug.nl')FTP.size('README.nluug')FTP.quit()
According to the ftplib docs (https://docs.python.org/3/library/ftplib.html) the syntax should be:
Code:
size(filename)
And on a Raspberry Pi I get a blinking cursor and when I after a while press CTRL+C I get:TypeError: FTP.size() missing 1 required positional argument: 'filename'
Traceback (most recent call last):
File "/home/pi/ftp2.py", line 2, in <module>
session = ftplib.FTP('ftp.nluug.nl')
File "/usr/lib/python3.9/ftplib.py", line 119, in __init__
self.connect(host)
File "/usr/lib/python3.9/ftplib.py", line 156, in connect
self.sock = socket.create_connection((self.host, self.port), self.timeout,
File "/usr/lib/python3.9/socket.py", line 831, in create_connection
sock.connect(sa)
WHY?! How do I fix this?
Statistics: Posted by nielsgeode — Mon Jul 01, 2024 9:43 am