Ah, ok then, thanks. =) Found the issue and almost solved it. Added from sage.structure.sage_object import register_unpickle_override import networkx.classes register_unpickle_override('networkx.xgraph','XGraph', networkx.classes.Graph, call_name=('networkx.classes','Graph')) register_unpickle_override('networkx.xdigraph','XDiGraph', networkx.classes.DiGraph, call_name=('networkx.classes','DiGraph'))
to the graph_backends.py This will pass the tests but it still isn't quite right. The issue is in unpickling graphs with multiple edges. Due to the nature of the networkx library changes, unpickling a graph with multiple edges results in one without multiple edges which is broken when calling edges() on it. I was thinking of writing a translation class that would take whatever input from either of the two deprecated classes. Then, to use it, require the user to call a convert() method or something on it, which would return the proper networkx class with appropriate data. This seems less than ideal, however, and some sort of post-unpickle hook would seem better, but poking around it doesn't seem that one exists. I would love suggestions for other ways to solve this. - Greg On Jan 29, 1:59 pm, "Nicolas M. Thiery" <nicolas.thi...@u-psud.fr> wrote: > On Fri, Jan 29, 2010 at 09:31:10AM -0800, Greg McWhirter wrote: > > Thanks for the rely. I tried that with boh Graph and Poset (since > > graph failed as well) under networkx-0.36 and networkx-1.0.1 both un > > un-patched 4.3.1 and patched to account for 1.0.1. > > However, everything went through without a hitch. > > > Un tar-ing the pickle_jar and load > > ("_class__sage_graphs_graph_Graph__.sobj") or load > > ("_class__sage_combinat_posets_posets_FinitePoset__.sobj") gives the > > error of "ImportError: No module named xgraph" or "ImportError: No > > module named xdigraph" respectively (these modules held the classes > > removed between 0.36 and 1.0.1). I don't know where these are getting > > called if the lines output by explain(dumps(P)) all work? > > Hmm. Then the best is to call explain_pickle directly on those files, > rather than guessing which object causes trouble. What you can try is > to extract the pickle jar in /tmp: > > tar jxvf /opt/sage-4.3.1/data/extcode/pickle_jar/pickle_jar.tar.bz2 > > and run: > > sage: > explain_pickle(file="/tmp/pickle_jar/_class__sage_graphs_graph_DiGraph__.so > bj") > pg_DiGraph = unpickle_global('sage.graphs.graph', 'DiGraph') > si1 = unpickle_newobj(pg_DiGraph, ()) > pg_NetworkXGraphBackend = > unpickle_global('sage.graphs.base.graph_backends', 'NetworkXGraphBackend') > si2 = unpickle_newobj(pg_NetworkXGraphBackend, ()) > pg_XDiGraph = unpickle_global('networkx.xdigraph', 'XDiGraph') > si3 = unpickle_newobj(pg_XDiGraph, ()) > si4 = {} > unpickle_build(si3, {'name':'', 'pred':{}, 'selfloops':False, 'succ':si4, > 'adj':si4, 'multiedges':False}) > unpickle_build(si2, {'_nxg':si3}) > unpickle_build(si1, {'_weighted':False, '_boundary':[], '_backend':si2, > '_pos':None}) > si1 > > Good luck! > Nicolas > -- > Nicolas M. Thi ry "Isil" <nthi...@users.sf.net>http://Nicolas.Thiery.name/ -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org