Seite 1 von 1

ftp.storlines("STOR "+Name,StringIO(Inhalt))

Verfasst: Dienstag 17. August 2004, 08:38
von genrich

Code: Alles auswählen

ftp.storlines("STOR "+Name,StringIO(Inhalt))
spuckt immer nur das aus:

Code: Alles auswählen

TypeError: 'module' object is not callable
      __doc__ = 'Inappropriate argument type.'
      __getitem__ = <bound method TypeError.__getitem__ of <exceptions.TypeError instance at 0x82366a4>>
      __init__ = <bound method TypeError.__init__ of <exceptions.TypeError instance at 0x82366a4>>
      __module__ = 'exceptions'
      __str__ = <bound method TypeError.__str__ of <exceptions.TypeError instance at 0x82366a4>>
      args = ("'module' object is not callable",)

In einem anderen Fall mache ich es mit

Code: Alles auswählen

ftp.storlines("STOR "+Name, open( Datei, "r" ) )
das geht...

Verfasst: Dienstag 17. August 2004, 08:41
von genrich
Ach was bin ich doof, es muß natürlich so heißen:

Code: Alles auswählen

ftp.storlines("STOR "+Name, StringIO.StringIO(Inhalt) )

Verfasst: Dienstag 17. August 2004, 17:25
von Sorgenkind
hoffentlich machst du:

import cStringIO as StringIO

weil StringIO.StringIO ist viel langsamer als cStringIO.StringIO

Verfasst: Dienstag 17. August 2004, 19:00
von Dookie
oder noch besser

Code: Alles auswählen

from cStringIO import StringIO
dann sparst Du dir das StringIO. und es geht mit StringIO("...")


Gruß

Dookie