Error on %attach for import __future__
using sagemath version 7.0 and 7.2, I tried to attach a file with %attach file.sage. The first line in the file is
from __future__ import division
which results in
sage: %attach file.sage File "/home/user/.sage/temp/host/25397/file.sageTVxNnD.py", line 6 from __future__ import division SyntaxError: from __future__ imports must occur at the beginning of the file
The error message is modified to hide user/host/... info
There is a older question on ask.sagemath /question/9071/future-import-fails-in-loading-external-cython-file/ which is addressing the same problem from 2012 on SageMath version 5.0 but there is no answer. I'm baffled that the error occurs in line 6 since the import statement is in the first line in the attached file.
Any ideas how to fix this?