FTP
Communication between Raspberry Pi and other system via Ethernet or WiFi:
Code:
import pygame
import pygame.camera
import requests
import os
import sys
import ftplib
from ftplib import FTP
pygame.camera.init()
cam = pygame.camera.Camera("/dev/video0",(640,480))
cam.start()
img = cam.get_image()
pygame.image.save(img,"image.jpg")
File2Send = "image.jpg"
Output_Directory = "/data/images"
ftp = FTP("xxx.xx.xxx.xxx")
ftp.login("track","abc@123")
abc=File2Send
file = open(abc , "rb")
ftp.cwd(Output_Directory)
print "STORing File now..."
ftp.quit()
file.close()
print "File transfered"
time.sleep(10)
os.remove(abc)
0 comments:
Post a Comment
if you have any doubt please let me know