ho questo codice:TypeError: deve essere stringa, non unicode
...
msgdict = {'datafile': datafile, 'mapper': mapper, 'reducer':reducer}
msg = cPickle.dumps(msgdict)
print msg
Il msg stampa ottengo questo:
(dp1
S'mapper'
p2
(S's3n://myFolder/mapper.py'
p3
tp4
sS'datafile'
p5
(S's3n://myFolder/test.txt'
p6
tp7
sS'reducer'
p8
(S's3n://myFolder/reducer.py'
p9
tp10
s.
Poi Im cercando di ottenere i miei contenuti:
for i in range(count):
m = q[0].read()
# this print returns a object Message
print m
# m.get_body()) returns the same of print msg above
msg = cPickle.loads(m.get_body())
Ma sto avendo questo errore:
msg = cPickle.loads(m.get_body())
TypeError: must be string, not unicode
Qualcuno sa come risolvere questo errore?
Hai provato 'repr()' tutte le stringhe? –
cos'è 'm',' q' o 'get_body'? – Daniel