Hi Jan Erik,

Nice to see you here on the list! Welcome!

Short answer: Serialize to the id of node, then use neo.node[id] to
unserialize.

I haven't thought about support for pickle before, but that could be a nice
addition. The above is (roughly) what it would do. The main difference being
that the pickled state would have to keep track of the neo4j instance as
well since there potentially could be multiple neo4j instances, but that is
doable, since the neo4j instances are uniquely identified by their
resource-uri (the path where the data is stored).

Cheers,
Tobias

On Fri, Dec 11, 2009 at 11:36 AM, Jan Erik Solem <jeso...@gmail.com> wrote:

> I have a question on the best way to save an index in Python. I use a
> dictionary to index nodes representing images that can contain
> objects. Like this: {'image00001.jpg': <neo4j._primitives.Node object
> at 0x92166ac>, ...}
>
> To save this index, I tried using Pickle:
>
> def save(self,filename):
>    # save indexes etc
>    f = open(filename, 'wb')
>    pickle.dump(self.image_index,f)
>    f.close()
>
> This does not work and my interpretation of the errors is that the
> problem being the Node object not being Pickleable. Anyone have ideas
> or a better suggestion?
>
> /Jan Erik
> _______________________________________________
> Neo mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Tobias Ivarsson <tobias.ivars...@neotechnology.com>
Hacker, Neo Technology
www.neotechnology.com
Cellphone: +46 706 534857
_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to