Seite 1 von 1

PIL Image mit ftplib auf Server laden

Verfasst: Freitag 19. März 2010, 18:59
von Bonzo1993
Hi @ all,

gibt es eine Möglichkeit ein PIL-Image mit der ftplib-Methode"storbinary()" auf einen FTP-Server hochzuladen?

Danke!

Verfasst: Freitag 19. März 2010, 19:08
von tjuXx

Code: Alles auswählen

storbinary('STORE dateiname', image)
dateiname ist der Name unter dem das Bild gespeichert wird. image ist ein PIL.Objekt.
So solltes es eigenlich gehen.

Verfasst: Freitag 19. März 2010, 21:45
von Bonzo1993
das akzeptiert Python leider nicht: AttributeError: read

Code: Alles auswählen

Traceback (most recent call last):
  File "C:\Users\Christoph\workspace\Motion Detection\src\VideoDevice.py", line 92, in <module>
    vd.enable()
  File "C:\Users\Christoph\workspace\Motion Detection\src\VideoDevice.py", line 55, in enable
    self.motiondetection()
  File "C:\Users\Christoph\workspace\Motion Detection\src\VideoDevice.py", line 86, in motiondetection
    Server.uploadFTP(self.imageCurrent)
  File "C:\Users\Christoph\workspace\Motion Detection\src\Server.py", line 59, in uploadFTP
    ftp.storbinary("STOR " + zeit + ".jpg", image)
  File "C:\Python26\lib\ftplib.py", line 450, in storbinary
    buf = fp.read(blocksize)
  File "C:\Python26\lib\site-packages\PIL\Image.py", line 493, in __getattr__
    raise AttributeError(name)
AttributeError: read
Das PIL-Image scheint nicht vergleichbar mit einer binären Bilddatei

Verfasst: Samstag 20. März 2010, 08:36
von querdenker
Zeig mal mehr Code, bitte hier posten da die Forensoftware sonst Probleme bekommt.

Verfasst: Samstag 20. März 2010, 11:32
von snafu
Du könntest (ungetestet) `StringIO(im.tostring())` übergeben.