0

I am trying to use a Jupyter notebook that was written by somebody else around 8 years ago. And the contents are written in Python2 and not Python3 that I am using. I am new to it and I can't figure out the reason for the syntax error. The following are the contents of the first cells that is giving a syntax error.

`# Always run this first
# NOTE: Do not define new basic variables in this notebook;
#       define them in Variables_Q.ipynb.  Use this notebook
#       to define new expressions built from those variables.

from __future__ import division # This needs to be here, even though it's in Variables_Q.ipynb
import sys
import os
sys.path.append(os.path.join(os.path.dirname('/home/khushal/Desktop/Python/Git Repositories/PostNewtonian/PNTerms'
)) # Look for modules in directory above this one
exec(open('../Utilities/ExecNotebook.ipy').read(),{})
from ExecNotebook.ipy import execnotebook
try: execnotebook(VariablesNotebook)
except: execnotebook('Variables_Q.ipynb')`

The error is

File "/tmp/ipykernel_31372/53020713.py", line 11
    exec(open('../Utilities/ExecNotebook.ipy').read(),{})
    ^
SyntaxError: invalid syntax


I tried to use a 2to3 jupter notebook converter but it didn't change the jupyter notebook at all and it is giving the same result.

Khushal
  • 123
  • 1
  • 4

0 Answers0