Ask Your Question
1

Python version mismatch

asked 2020-11-19 11:26:14 +0100

Andr gravatar image

I call: load("secp256k1.sage" where secp256k1.sage is from Bitcoin sources. I obtain:

  Traceback (most recent call last):

  File "/home/andrzej/SageMath/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  File "<ipython-input-3-6446b3e63292>", line 1, in <module>
    load("secp256k1.sage")

  File "sage/misc/persist.pyx", line 143, in sage.misc.persist.load (build/cythonized/sage/misc/persist.c:2558)
    sage.repl.load.load(filename, globals())

  File "/home/andrzej/SageMath/local/lib/python3.8/site-packages/sage/repl/load.py", line 272, in load
    exec(preparse_file(f.read()) + "\n", globals)

  File "<string>", line 6, in <module>

  File "sage/misc/persist.pyx", line 143, in sage.misc.persist.load (build/cythonized/sage/misc/persist.c:2558)
    sage.repl.load.load(filename, globals())

  File "/home/andrzej/SageMath/local/lib/python3.8/site-packages/sage/repl/load.py", line 272, in load
    exec(preparse_file(f.read()) + "\n", globals)

  File "<string>", line 178
    print "Formula %s on Z%i:" % (name, p)
          ^
SyntaxError: invalid syntax

It uses python3.8 and print statement from Python 2.x

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-11-19 11:50:10 +0100

tmonteil gravatar image

updated 2020-11-19 11:52:19 +0100

Indeed, recent versions of Sage run Python 3 only, and the code from bitcoin seems to be Python 2 (print satement without parentheses). There is nothing to do on Sage side as we will not move back to Python 2. Instead, the bitcoin source code should be updated. Thanks for reporting anyway, could you report on bitcoin issue as well ?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-11-19 11:26:14 +0100

Seen: 624 times

Last updated: Nov 19 '20