In a Spyder iPython console:
print(sys.version)
3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:09:58)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]
and in a Ubuntu GNOME terminal 3.18.3:
rappleto:~$ python
Python 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:09:58)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
so identical versions and builds of Python
In Spyder:
In [4]: with open("pid.cpp") as pidcpp:
...: data=pidcpp.read()
...: print(data)
...:
// pid.cpp - author: rappleto
#include <PID_v1.h>
...
in terminal:
>>> with open("pid.cpp") as pidcpp:
... data=pidcpp.read()
... print(data)
File "<stdin>", line 3
print(data)
^
SyntaxError: invalid syntax
Is there some special way to end a "with" statement in the terminal?