Ask Your Question
1

Python version mismatch

asked 4 years ago

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

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 4 years ago

tmonteil gravatar image

updated 4 years ago

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 ?

Preview: (hide)
link

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: 4 years ago

Seen: 753 times

Last updated: Nov 19 '20