Implement pickle module into Skulpt

Server functions cannot return complex objects to client code. I was trying to get around this by pickling the object I wanted to return, storing it into a Media Object (which can be returned by server functions) and unpickling it on the client side. For instance:

#Server Code
@anvil.server.callable
def get_object():
    media_object = anvil.BlobMedia(app_tables.files.get(Name='pickled_object')['Data'].get_bytes() )
    return media_object

#Client Code
media_object= anvil.server.call_s('get_object')
object= pickle.loads(media_object.get_bytes())

The problem is that the pickle module is still not implemented into Skulpt; I get the following error: “NotImplementedImportError: pickle is not yet implemented in Skulpt”

Please implement the pickle in skulpt so that any object can be returned from server to client code

You might want to have a look at Portable Classes

2 Likes

Pickling has a (well-deserved) reputation for creating more problems (and worse problems) than it solves. So I second Owen’s suggestion.

2 Likes