Re: [sage-support] Weird bug in libgap?

2020-08-19 Thread Dima Pasechnik
I double-checked this, and it is in fact a bug in GAP (GAP 4.10).

gap> for A in AllPrimitiveGroups( DegreeOperation,[3]) do
> for G in NormalSubgroups(A) do
> for U in ConjugacyClassesSubgroups(G) do
> P := TrivialCharacter(Representative(U));
> for x in ConjugacyClassesSubgroups(G) do
> Print("x=", x, "\n");
> for y in ConjugacyClassesSubgroups(Representative(x)) do
> Print(y);
> od;od;od;
> od;od;
x=ConjugacyClassSubgroups(A(3),Group( () ))
Error, usage: FreeGroup(,..) or FreeGroup() at
/home/dimpase/sage/local/share/gap/lib/grpfree.gi:467 called from
FreeGroup( deg - 1, nam ) at
/home/dimpase/sage/local/share/gap/lib/gpprmsya.gi:1753 called from
IsomorphismFpGroup( G, Concatenation( "S_", String( Length(
MovedPoints( G ) ) ), "." ) ) at
/home/dimpase/sage/local/share/gap/lib/gpprmsya.gi:1729 called from
IsomorphismFpGroup( Image( hom ) ) at
/home/dimpase/sage/local/share/gap/lib/grplatt.gi:890 called from
LatticeSubgroups( G ) at
/home/dimpase/sage/local/share/gap/lib/grplatt.gi:208 called from
ConjugacyClassesSubgroups( Representative( x ) ) at *stdin*:36 called from
...  at *stdin*:39
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk>


On Sat, Aug 15, 2020 at 12:13 AM Dima Pasechnik  wrote:
>
> it is not libgap, it is pexpect GAP that is used here - something we should 
> get rid of.
>
>
> On Fri, 14 Aug 2020, 23:39 'Peter Mueller' via sage-support, 
>  wrote:
>>
>> The following code yields a Traceback for no (to me) obvious reason. The 
>> same happens on sagecell too. It seems to be a minimal case. For instance 
>> removing the line "P = ..." or having less deeply nested loops does not 
>> display this problem:
>>
>> for A in PrimitiveGroups(3):
>> for G in A.normal_subgroups():
>> for U in G.conjugacy_classes_subgroups():
>> P = U.trivial_character()
>> for x in G.conjugacy_classes_subgroups():
>> for y in x.conjugacy_classes_subgroups():
>> pass
>>
>> GAPError  Traceback (most recent call last)
>>  in ()
>> > 1 load('./bug2.sage')
>>
>> /home/mueller/local/sage-9.1/local/lib/python3.7/site-packages/sage/misc/persist.pyx
>>  in sage.misc.persist.load (build/cythonized/sage/misc/persist.c:2538)()
>> 142
>> 143 if sage.repl.load.is_loadable_filename(filename):
>> --> 144 sage.repl.load.load(filename, globals())
>> 145 return
>> 146
>> [.. SNIP .]
>> > 2514 sig_on()
>>2515 if n == 0:
>>2516 result = CALL_0ARGS(self.value)
>>
>> GAPError: Error, usage: FreeGroup(,..) or FreeGroup()
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "sage-support" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to sage-support+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sage-support/cad3b419-62f4-4c68-9a52-974cb6a01deao%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAAWYfq2i98_DopfRNoXN57BRdHfv%3D-V%3DHHHeZVwYJ0L2osqAbg%40mail.gmail.com.


[sage-support] A root systems short algorithm : "ValueError: too many values to unpack"

2020-08-19 Thread Sarah DIJOLS

Hello,
I am running the following code (part of an ongoing math project):
























*e = RootSystem(['E',6]).ambient_space()Roots = e.roots() a1 = vector((1/2, 
-1/2, -1/2, -1/2, -1/2, -1/2, -1/2, 1/2))a2 = vector((1, 1, 0, 0, 0, 0, 0, 
0))a3 = vector((-1, 1, 0, 0, 0, 0, 0, 0))a4 = vector((0, -1, 1, 0, 0, 0, 0, 
0))a5 = vector((0, 0, -1, 1, 0, 0, 0, 0))a6 = vector((0, 0, 0, -1, 1, 0, 0, 
0))Lini = [a1, a2, a3, a4, a5]def proj(t, ai):myLone = vector(ai)
result= t - myLone.dot_product(t) / (ai.dot_product(ai))*myLonereturn 
resultmyP = [proj(x, a6) for x in Lini][proja1, proja2, proja3, proja4, 
proja5] = myPmyR = [vector(v) for v in Roots]myL = [proj(x, a6) for x in 
myR]len(myL)*






* # produce all combinaisons of five vectors  with 2 vectors in myL and 3 
in myPmyPlist1= Combinations(myP, 3).list()myLlist1= Combinations(myL, 
2).list() *

*#Alternatively I would have like to use 5 vectors combinaisons in another 
function of mine but again it seems the error of "too many values" unable 
me to do so :*



















*#myLlist= Combinations(myL, 5).list()def letsapply(listg, alist):for 
listel in listg:myPset1= set(tuple(v) for v in listel)
print(myPset1)for listel2 in alist:myLset1= set(tuple(v) for v 
in listel2)print(myLset1)myLset1= 
myLset1.union(myPset1)if len(myLset1) >= 5:
print(myLset1, "myLset1")if len(myLset1) >= 5:for myLel 
in myLset1:[proja1, proja2, proja3, proja4, proja5] = 
myLelprint(myLel)print(letsapply(myPlist1,myLlist1))*

Is there a way to handle this "capacity" issue? I am quite new to SAGE, I 
have been using it on cocalc and with Jupyter. Thanks a lot for your help.
Best,
Sarah Dijols (Math postdoc in Tsinghua University)



-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/3fb8b554-3dfe-43ea-a752-c9dd7ff2aca6n%40googlegroups.com.


[sage-support] Loading an object containing a matrix that was saved in Python 2 sage

2020-08-19 Thread Paul Leopardi
Hello,
I am currently trying to convert my Boolean-Cayley-graphs project from 
Python 2 to Python 3 Sage. 
https://github.com/penguian/Boolean-Cayley-graphs/tree/23-port-to-python-3

I have succeeded in converting the code, but am having a tough time trying 
to load objects that were saved by my previous Python 2-based code. These 
objects contain matrices as members.What do I need to do to be able to load 
these objects?

As far as I can tell, load(...,encoding='latin-1') doesn't work with a dict 
containing a matrix but load(...,encoding='bytes') does. See the attachment.
Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/ca2c8bd4-b465-4e9f-ba50-d9b431444829n%40googlegroups.com.
~/test-matrix-save-load$ sage
┌┐
│ SageMath version 8.6.rc0, Release Date: 2019-01-03 │
│ Using Python 2.7.15. Type "help()" for help.   │
└┘
┏┓
┃ Warning: this is a prerelease version, and it may be unstable. ┃
┗┛
sage: m=matrix([[1,2,3],[4,5,7]])
sage: m
[1 2 3]
[4 5 7]
sage: d={'1':0,'2':'Hello','3':m}
sage: d
{'1': 0, '2': 'Hello', '3': [1 2 3]
 [4 5 7]}
sage: save(m,'m')
sage: save(d,'d')
sage: dl=load('d.sobj')
sage: dl==d
True
sage: df=open('d.sobj','rb').read()
sage: explain_pickle(df)
pg_make_integer = unpickle_global('sage.rings.integer', 'make_integer')
pg_unpickle = unpickle_global('sage.matrix.matrix0', 'unpickle')
pg_Matrix_integer_dense = unpickle_global('sage.matrix.matrix_integer_dense', 
'Matrix_integer_dense')
pg_unreduce = unpickle_global('sage.structure.unique_representation', 
'unreduce')
pg_MatrixSpace = unpickle_global('sage.matrix.matrix_space', 'MatrixSpace')
pg_IntegerRing = unpickle_global('sage.rings.integer_ring', 'IntegerRing')
pg = unpickle_instantiate(pg_IntegerRing, ())
{'1':pg_make_integer('0'), '3':pg_unpickle(pg_Matrix_integer_dense, 
pg_unreduce(pg_MatrixSpace, (pg, 2r, 3r, False, pg_Matrix_integer_dense), {}), 
False, None, '1 2 3 4 5 7', 0r), '2':'Hello'}
sage: quit
Exiting Sage (CPU time 0m0.82s, Wall time 3m12.86s).

~/test-matrix-save-load$ sage
┌┐
│ SageMath version 9.1, Release Date: 2020-05-20 │
│ Create a "Sage Worksheet" file for the notebook interface. │
│ Enhanced for CoCalc.   │
│ Using Python 3.7.3. Type "help()" for help.│
└┘
sage: df=open('d.sobj','rb').read()
sage: explain_pickle(df)
pg_make_integer = unpickle_global('sage.rings.integer', 'make_integer')
pg_unpickle = unpickle_global('sage.matrix.matrix0', 'unpickle')
pg_Matrix_integer_dense = unpickle_global('sage.matrix.matrix_integer_dense', 
'Matrix_integer_dense')
pg_unreduce = unpickle_global('sage.structure.unique_representation', 
'unreduce')
pg_MatrixSpace = unpickle_global('sage.matrix.matrix_space', 'MatrixSpace')
pg_IntegerRing = unpickle_global('sage.rings.integer_ring', 'IntegerRing')
pg = unpickle_instantiate(pg_IntegerRing, ())
{'1':pg_make_integer('0'), '3':pg_unpickle(pg_Matrix_integer_dense, 
pg_unreduce(pg_MatrixSpace, (pg, 2r, 3r, False, pg_Matrix_integer_dense), {}), 
False, None, '1 2 3 4 5 7', 0r), '2':'Hello'}
sage: dl=load('d.sobj')
---
RuntimeError  Traceback (most recent call last)
 in ()
> 1 dl=load('d.sobj')

/ext/sage/sage-9.1/local/lib/python3.7/site-packages/sage/misc/persist.pyx in 
sage.misc.persist.load (build/cythonized/sage/misc/persist.c:2900)()
156
157 ## Load file by absolute filename
--> 158 with open(filename, 'rb') as fobj:
159 X = loads(fobj.read(), compress=compress, **kwargs)
160 try:

/ext/sage/sage-9.1/local/lib/python3.7/site-packages/sage/misc/persist.pyx in 
sage.misc.persist.load (build/cythonized/sage/misc/persist.c:2850)()
157 ## Load file by absolute filename
158 with open(filename, 'rb') as fobj:
--> 159 X = loads(fobj.read(), compress=compress, **kwargs)
160 try:
161 X._default_filename = os.path.abspath(filename)

/ext/sage/sage-9.1/local/lib/python3.7/site-packages/sage/misc/persist.pyx in 
sage.misc.persist.loads (build/cythonized/sage/misc/persist.c:7424)()
   1042
   1043 unpickler = SageUnpickler(io.BytesIO(s), **kwargs)
-> 1044 return unpickler.load()
   1045
   1046

/e

[sage-support] Re: Loading an object containing a matrix that was saved in Python 2 sage

2020-08-19 Thread Paul Leopardi
See also 
https://groups.google.com/g/sage-support/c/3WKui-LojKs/m/DgEPBGF3AQAJ and 
https://trac.sagemath.org/ticket/28444

On Wednesday, 19 August 2020 at 22:17:40 UTC+10 Paul Leopardi wrote:

> Hello,
> I am currently trying to convert my Boolean-Cayley-graphs project from 
> Python 2 to Python 3 Sage. 
> https://github.com/penguian/Boolean-Cayley-graphs/tree/23-port-to-python-3
>
> I have succeeded in converting the code, but am having a tough time trying 
> to load objects that were saved by my previous Python 2-based code. These 
> objects contain matrices as members.What do I need to do to be able to load 
> these objects?
>
> As far as I can tell, load(...,encoding='latin-1') doesn't work with a 
> dict containing a matrix but load(...,encoding='bytes') does. See the 
> attachment.
> Thanks!
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/06074cc2-8777-4171-b92b-8aab8e982a73n%40googlegroups.com.


Re: [sage-support] Weird bug in libgap?

2020-08-19 Thread Dima Pasechnik
On Wed, Aug 19, 2020 at 11:22 AM Dima Pasechnik  wrote:
>
> I double-checked this, and it is in fact a bug in GAP (GAP 4.10).

And in the current GAP master and in GAP 4.11.0 this example works
just fine. So it's fixed there,
now we need to work on https://trac.sagemath.org/ticket/29314

>
> gap> for A in AllPrimitiveGroups( DegreeOperation,[3]) do
> > for G in NormalSubgroups(A) do
> > for U in ConjugacyClassesSubgroups(G) do
> > P := TrivialCharacter(Representative(U));
> > for x in ConjugacyClassesSubgroups(G) do
> > Print("x=", x, "\n");
> > for y in ConjugacyClassesSubgroups(Representative(x)) do
> > Print(y);
> > od;od;od;
> > od;od;
> x=ConjugacyClassSubgroups(A(3),Group( () ))
> Error, usage: FreeGroup(,..) or FreeGroup() at
> /home/dimpase/sage/local/share/gap/lib/grpfree.gi:467 called from
> FreeGroup( deg - 1, nam ) at
> /home/dimpase/sage/local/share/gap/lib/gpprmsya.gi:1753 called from
> IsomorphismFpGroup( G, Concatenation( "S_", String( Length(
> MovedPoints( G ) ) ), "." ) ) at
> /home/dimpase/sage/local/share/gap/lib/gpprmsya.gi:1729 called from
> IsomorphismFpGroup( Image( hom ) ) at
> /home/dimpase/sage/local/share/gap/lib/grplatt.gi:890 called from
> LatticeSubgroups( G ) at
> /home/dimpase/sage/local/share/gap/lib/grplatt.gi:208 called from
> ConjugacyClassesSubgroups( Representative( x ) ) at *stdin*:36 called from
> ...  at *stdin*:39
> you can 'quit;' to quit to outer loop, or
> you can 'return;' to continue
> brk>
>
>
> On Sat, Aug 15, 2020 at 12:13 AM Dima Pasechnik  wrote:
> >
> > it is not libgap, it is pexpect GAP that is used here - something we should 
> > get rid of.
> >
> >
> > On Fri, 14 Aug 2020, 23:39 'Peter Mueller' via sage-support, 
> >  wrote:
> >>
> >> The following code yields a Traceback for no (to me) obvious reason. The 
> >> same happens on sagecell too. It seems to be a minimal case. For instance 
> >> removing the line "P = ..." or having less deeply nested loops does not 
> >> display this problem:
> >>
> >> for A in PrimitiveGroups(3):
> >> for G in A.normal_subgroups():
> >> for U in G.conjugacy_classes_subgroups():
> >> P = U.trivial_character()
> >> for x in G.conjugacy_classes_subgroups():
> >> for y in x.conjugacy_classes_subgroups():
> >> pass
> >>
> >> GAPError  Traceback (most recent call last)
> >>  in ()
> >> > 1 load('./bug2.sage')
> >>
> >> /home/mueller/local/sage-9.1/local/lib/python3.7/site-packages/sage/misc/persist.pyx
> >>  in sage.misc.persist.load (build/cythonized/sage/misc/persist.c:2538)()
> >> 142
> >> 143 if sage.repl.load.is_loadable_filename(filename):
> >> --> 144 sage.repl.load.load(filename, globals())
> >> 145 return
> >> 146
> >> [.. SNIP .]
> >> > 2514 sig_on()
> >>2515 if n == 0:
> >>2516 result = CALL_0ARGS(self.value)
> >>
> >> GAPError: Error, usage: FreeGroup(,..) or FreeGroup()
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups 
> >> "sage-support" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an 
> >> email to sage-support+unsubscr...@googlegroups.com.
> >> To view this discussion on the web visit 
> >> https://groups.google.com/d/msgid/sage-support/cad3b419-62f4-4c68-9a52-974cb6a01deao%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAAWYfq1ZkiCQfJmgQO7byweU%2BnJ5aLy4tisF0Py3HKN9nqL-8w%40mail.gmail.com.


[sage-support] Re: Loading an object containing a matrix that was saved in Python 2 sage

2020-08-19 Thread Nils Bruin
On Wednesday, August 19, 2020 at 5:24:48 AM UTC-7, Paul Leopardi wrote:
>
> See also 
> https://groups.google.com/g/sage-support/c/3WKui-LojKs/m/DgEPBGF3AQAJ and 
> https://trac.sagemath.org/ticket/28444
>
> On Wednesday, 19 August 2020 at 22:17:40 UTC+10 Paul Leopardi wrote:
>
>> Hello,
>> I am currently trying to convert my Boolean-Cayley-graphs project from 
>> Python 2 to Python 3 Sage. 
>> https://github.com/penguian/Boolean-Cayley-graphs/tree/23-port-to-python-3
>>
>> I have succeeded in converting the code, but am having a tough time 
>> trying to load objects that were saved by my previous Python 2-based code. 
>> These objects contain matrices as members.What do I need to do to be able 
>> to load these objects?
>>
>> As far as I can tell, load(...,encoding='latin-1') doesn't work with a 
>> dict containing a matrix but load(...,encoding='bytes') does. See the 
>> attachment.
>> Thanks!
>>
>
Yes, we know how to fix it and it's not complicated: if "bytes" is expected 
in a pickle and a "str" is found, we should assume it represents the 
bytes-object via latin-1. It's come up in matrices elsewhere and we should 
just make this change. We've already determined that "encoding='bytes'" is 
a lot harder to get to work.

Please open a ticket. Fixing this should save a LOT of pickles.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/017828a5-9275-463f-aa14-852ec95b3a9do%40googlegroups.com.


[sage-support] Re: A root systems short algorithm : "ValueError: too many values to unpack"

2020-08-19 Thread rickhg12hs
> [proja1, proja2, proja3, proja4, proja5] = myLel

Here you are setting a list of 5 variables to a tuple of 8 elements?

Did you want to call your `proj` function before this?

On Wednesday, August 19, 2020 at 2:15:56 PM UTC+2 Sarah DIJOLS wrote:

>
> Hello,
> I am running the following code (part of an ongoing math project):
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *e = RootSystem(['E',6]).ambient_space()Roots = e.roots() a1 = 
> vector((1/2, -1/2, -1/2, -1/2, -1/2, -1/2, -1/2, 1/2))a2 = vector((1, 1, 0, 
> 0, 0, 0, 0, 0))a3 = vector((-1, 1, 0, 0, 0, 0, 0, 0))a4 = vector((0, -1, 1, 
> 0, 0, 0, 0, 0))a5 = vector((0, 0, -1, 1, 0, 0, 0, 0))a6 = vector((0, 0, 0, 
> -1, 1, 0, 0, 0))Lini = [a1, a2, a3, a4, a5]def proj(t, ai):myLone = 
> vector(ai)result= t - myLone.dot_product(t) / 
> (ai.dot_product(ai))*myLonereturn resultmyP = [proj(x, a6) for x in 
> Lini][proja1, proja2, proja3, proja4, proja5] = myPmyR = [vector(v) for v 
> in Roots]myL = [proj(x, a6) for x in myR]len(myL)*
>
>
>
>
>
>
> * # produce all combinaisons of five vectors  with 2 vectors in myL and 3 
> in myPmyPlist1= Combinations(myP, 3).list()myLlist1= Combinations(myL, 
> 2).list() *
>
> *#Alternatively I would have like to use 5 vectors combinaisons in another 
> function of mine but again it seems the error of "too many values" unable 
> me to do so :*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *#myLlist= Combinations(myL, 5).list()def letsapply(listg, alist):for 
> listel in listg:myPset1= set(tuple(v) for v in listel)
> print(myPset1)for listel2 in alist:myLset1= set(tuple(v) for v 
> in listel2)print(myLset1)myLset1= 
> myLset1.union(myPset1)if len(myLset1) >= 5:
> print(myLset1, "myLset1")if len(myLset1) >= 5:for myLel 
> in myLset1:[proja1, proja2, proja3, proja4, proja5] = 
> myLelprint(myLel)print(letsapply(myPlist1,myLlist1))*
>
> Is there a way to handle this "capacity" issue? I am quite new to SAGE, I 
> have been using it on cocalc and with Jupyter. Thanks a lot for your help.
> Best,
> Sarah Dijols (Math postdoc in Tsinghua University)
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/55cba056-5e54-4bd4-8bbf-b07ceb8c3180n%40googlegroups.com.


[sage-support] Re: Loading an object containing a matrix that was saved in Python 2 sage

2020-08-19 Thread Paul Leopardi
Done. https://trac.sagemath.org/ticket/30402

On Thursday, 20 August 2020 at 02:35:15 UTC+10 Nils Bruin wrote:

> On Wednesday, August 19, 2020 at 5:24:48 AM UTC-7, Paul Leopardi wrote:
>>
>> See also 
>> https://groups.google.com/g/sage-support/c/3WKui-LojKs/m/DgEPBGF3AQAJ 
>> and https://trac.sagemath.org/ticket/28444
>>
>> On Wednesday, 19 August 2020 at 22:17:40 UTC+10 Paul Leopardi wrote:
>>
>>> Hello,
>>> I am currently trying to convert my Boolean-Cayley-graphs project from 
>>> Python 2 to Python 3 Sage. 
>>> https://github.com/penguian/Boolean-Cayley-graphs/tree/23-port-to-python-3
>>>
>>> I have succeeded in converting the code, but am having a tough time 
>>> trying to load objects that were saved by my previous Python 2-based code. 
>>> These objects contain matrices as members.What do I need to do to be able 
>>> to load these objects?
>>>
>>> As far as I can tell, load(...,encoding='latin-1') doesn't work with a 
>>> dict containing a matrix but load(...,encoding='bytes') does. See the 
>>> attachment.
>>> Thanks!
>>>
>>
> Yes, we know how to fix it and it's not complicated: if "bytes" is 
> expected in a pickle and a "str" is found, we should assume it represents 
> the bytes-object via latin-1. It's come up in matrices elsewhere and we 
> should just make this change. We've already determined that 
> "encoding='bytes'" is a lot harder to get to work.
>
> Please open a ticket. Fixing this should save a LOT of pickles.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/16c52cc2-4a50-45b5-bee9-af82e125e4bfn%40googlegroups.com.


[sage-support] Re: Loading an object containing a matrix that was saved in Python 2 sage

2020-08-19 Thread Paul Leopardi
I have about 6 TB of saved Sage objects that I would like to recover, so am 
interested in testing the fix.


On Thursday, 20 August 2020 at 14:10:34 UTC+10 Paul Leopardi wrote:

> Done. https://trac.sagemath.org/ticket/30402
>
> On Thursday, 20 August 2020 at 02:35:15 UTC+10 Nils Bruin wrote:
>
>> On Wednesday, August 19, 2020 at 5:24:48 AM UTC-7, Paul Leopardi wrote:
>>>
>>> See also 
>>> https://groups.google.com/g/sage-support/c/3WKui-LojKs/m/DgEPBGF3AQAJ 
>>> and https://trac.sagemath.org/ticket/28444
>>>
>>> On Wednesday, 19 August 2020 at 22:17:40 UTC+10 Paul Leopardi wrote:
>>>
 Hello,
 I am currently trying to convert my Boolean-Cayley-graphs project from 
 Python 2 to Python 3 Sage. 
 https://github.com/penguian/Boolean-Cayley-graphs/tree/23-port-to-python-3

 I have succeeded in converting the code, but am having a tough time 
 trying to load objects that were saved by my previous Python 2-based code. 
 These objects contain matrices as members.What do I need to do to be able 
 to load these objects?

 As far as I can tell, load(...,encoding='latin-1') doesn't work with a 
 dict containing a matrix but load(...,encoding='bytes') does. See the 
 attachment.
 Thanks!

>>>
>> Yes, we know how to fix it and it's not complicated: if "bytes" is 
>> expected in a pickle and a "str" is found, we should assume it represents 
>> the bytes-object via latin-1. It's come up in matrices elsewhere and we 
>> should just make this change. We've already determined that 
>> "encoding='bytes'" is a lot harder to get to work.
>>
>> Please open a ticket. Fixing this should save a LOT of pickles.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/ce3aeb65-4d8b-4d67-b8ac-64f1d35c56fen%40googlegroups.com.