PicklingError: Can't pickle <type 'function'>: attribute lookup __builtin__.function failed

253 views
Skip to first unread message

Will Du

unread,
Dec 20, 2013, 12:42:57 PM12/20/13
to bambo...@googlegroups.com
Hi folks,
I setup the bamboo server and posting csv files sucessfully. However, when I post json files, it returns error as follows. Could any one help me to figure it out?
here is my json file {"formula":"food", "name":"sweet foods"}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
    <title>500 Internal Server Error</title>
    <style type="text/css">
    #powered_by {
        margin-top: 20px;
        border-top: 2px solid black;
        font-style: italic;
    }

    #traceback {
        color: red;
    }
    </style>
</head>
    <body>
        <h2>500 Internal Server Error</h2>
        <p>The server encountered an unexpected condition which prevented it from fulfilling the request.</p>
        <pre id="traceback">Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 656, in respond
    response.body = self.handler()
  File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line 188, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py", line 34, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/bamboo/controllers/datasets.py", line 265, in create
    dataset.import_from_json(json_file)
  File "/usr/local/lib/python2.7/dist-packages/bamboo/lib/io.py", line 109, in import_from_json
    file_reader=partial(file_reader, content))
  File "/usr/local/lib/python2.7/dist-packages/bamboo/lib/async.py", line 29, in call_async
    countdown=countdown, args=args, kwargs=kwargs)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/task.py", line 473, in apply_async
    **options)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/amqp.py", line 249, in publish_task
    **kwargs
  File "/usr/local/lib/python2.7/dist-packages/kombu/messaging.py", line 157, in publish
    compression, headers)
  File "/usr/local/lib/python2.7/dist-packages/kombu/messaging.py", line 233, in _prepare
    body) = encode(body, serializer=serializer)
  File "/usr/local/lib/python2.7/dist-packages/kombu/serialization.py", line 169, in encode
    payload = encoder(data)
  File "/usr/local/lib/python2.7/dist-packages/kombu/serialization.py", line 357, in dumps
    return dumper(obj, protocol=pickle_protocol)
PicklingError: Can't pickle &lt;type 'function'&gt;: attribute lookup __builtin__.function failed
</pre>
    <div id="powered_by">
    <span>Powered by <a href="http://www.cherrypy.org">CherryPy 3.2.4</a></span>
    </div>
    </body>
</html>

Peter Lubell-Doughtie

unread,
Dec 20, 2013, 12:55:11 PM12/20/13
to bambo...@googlegroups.com
Hi Will,

Try wrapping it in square brackets, the fixture used in the JSON upload test might be a helpful reference, https://github.com/pld/bamboo/blob/master/bamboo/tests/fixtures/good_eats.json


Will Du wrote:
Hi folks,
I setup the bamboo server and posting csv files sucessfully. However, when I post json files, it returns error as follows. Could any one help me to figure it out?
here is my json file {"formula":"food", "name":"sweet foods"}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; "></meta>

--
You received this message because you are subscribed to the Google Groups "bamboo-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bamboo-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages