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

Sockets, TCP/IP, (XML-)RPC und ähnliche Themen gehören in dieses Forum
Antworten
genrich
User
Beiträge: 91
Registriert: Sonntag 27. Juni 2004, 17:46

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...
genrich
User
Beiträge: 91
Registriert: Sonntag 27. Juni 2004, 17:46

Ach was bin ich doof, es muß natürlich so heißen:

Code: Alles auswählen

ftp.storlines("STOR "+Name, StringIO.StringIO(Inhalt) )
Sorgenkind
User
Beiträge: 34
Registriert: Samstag 24. Juli 2004, 19:25
Kontaktdaten:

hoffentlich machst du:

import cStringIO as StringIO

weil StringIO.StringIO ist viel langsamer als cStringIO.StringIO
Dookie
Python-Forum Veteran
Beiträge: 2010
Registriert: Freitag 11. Oktober 2002, 18:00
Wohnort: Salzburg
Kontaktdaten:

oder noch besser

Code: Alles auswählen

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


Gruß

Dookie
[code]#!/usr/bin/env python
import this[/code]
Antworten