Vra

Ek probeer om te installeer Chris Atlee se luislang Plakkaat biblioteek so ek 'n lêer kan oplaai met behulp van 'n HTTP POST navraag vanuit my script.

Op luislang 2.3, wanneer ek tik # python setup.py install, kry ek die volgende fout. Die installasie voort, maar ek kan nie later >>> import poster op.

byte-compiling build/bdist.linux-x86_64/egg/poster/encode.py to encode.pyc
  File "build/bdist.linux-x86_64/egg/poster/encode.py", line 112
    @classmethod
    ^
SyntaxError: invalid syntax
byte-compiling build/bdist.linux-x86_64/egg/poster/streaminghttp.py to streaminghttp.pyc
  File "build/bdist.linux-x86_64/egg/poster/streaminghttp.py", line 114
    newheaders = dict((k,v) for k,v in req.headers.items()
                              ^
SyntaxError: invalid syntax
byte-compiling build/bdist.linux-x86_64/egg/poster/__init__.py to __init__.pyc

Enige wenke?

Was dit nuttig?

Oplossing

Python 2.3 nie ondersteuning vir ontwerpers (dit is wat @classmethod is) of lys begripstoetse (dit is die tweede fout), so jy óf gaan hê om 'n ouer weergawe van Plakkaat, of stok met urllib vind / urllib2 om dit te doen jou HTTP werk.

Eintlik, dit lyk soos Plakkaat is geskep rondom Julie 2008, dus is daar waarskynlik nie 'n weergawe wat ondersteun Python 2.3, selfs as jy kan die oorspronklike bron te vind. Enige spesifieke rede waarom jy kan nie opgradeer na die nuutste Python 2.x ten minste?

Gelisensieer onder: CC-BY-SA met toeskrywing
Nie verbonde aan StackOverflow
scroll top