from scipy import maxentropy fails with Python 2.5

Hi all, I tried to compile scipy with Python 2.5 and Intel C++/Fortran compiler. The first import failed: In [1]:from scipy import * ------------------------------------------------------------ File "[...]/lib/python2.5/site-packages/scipy/maxentropy/maxentropy.py", line 69 from __future__ import division <type 'exceptions.SyntaxError'>: from __future__ imports must occur at the beginning of the file That problem was easy to fix just by following the instructions of that message in 2 files: scipy/maxentropy/maxentropy.py scipy/maxentropy/maxentutils.py Is that import necessary with Python 2.5 or even Python 2.4? Best regards, Lars

Lars Bittrich wrote:
Hi all,
I tried to compile scipy with Python 2.5 and Intel C++/Fortran compiler. The first import failed:
In [1]:from scipy import * ------------------------------------------------------------ File "[...]/lib/python2.5/site-packages/scipy/maxentropy/maxentropy.py", line 69 from __future__ import division <type 'exceptions.SyntaxError'>: from __future__ imports must occur at the beginning of the file
That problem was easy to fix just by following the instructions of that message in 2 files:
scipy/maxentropy/maxentropy.py scipy/maxentropy/maxentutils.py
Is that import necessary with Python 2.5 or even Python 2.4?
Yes. Integer division will not be changing in the 2.x releases. I'm checking in a change that moves those statements up, but not before docstrings. I don't have a 2.5 interpreter to check this out with, and I can see no reference to it in the "What's New" documentation, so please let me know if it works for you. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco

On Fri, 29 Sep 2006 11:47:57 -0500 Robert Kern <robert.kern@gmail.com> wrote:
Lars Bittrich wrote:
Hi all,
I tried to compile scipy with Python 2.5 and Intel C++/Fortran compiler. The first import failed:
In [1]:from scipy import * ------------------------------------------------------------ File "[...]/lib/python2.5/site-packages/scipy/maxentropy/maxentropy.py", line 69 from __future__ import division <type 'exceptions.SyntaxError'>: from __future__ imports must occur at the beginning of the file
That problem was easy to fix just by following the instructions of that message in 2 files:
scipy/maxentropy/maxentropy.py scipy/maxentropy/maxentutils.py
Is that import necessary with Python 2.5 or even Python 2.4?
Yes. Integer division will not be changing in the 2.x releases.
I'm checking in a change that moves those statements up, but not before docstrings. I don't have a 2.5 interpreter to check this out with, and I can see no reference to it in the "What's New" documentation, so please let me know if it works for you.
FWIW, it's been true since 2.1, that __future__ statements have to be the first bit of code in the module (excluding docstrings); see PEP 236 (http://www.python.org/dev/peps/pep-0236/). Looks like that hasn't been enforced for < 2.5 for features that the interpreter supports (although for non-supported features, like "from __future__ import blah", all the versions I have complain). -- |>|\/|< /--------------------------------------------------------------------------\ |David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/ |cookedm@physics.mcmaster.ca

On Friday 29 September 2006 18:47, Robert Kern wrote:
Lars Bittrich wrote:
Hi all,
I tried to compile scipy with Python 2.5 and Intel C++/Fortran compiler. The first import failed:
In [1]:from scipy import * ------------------------------------------------------------ File "[...]/lib/python2.5/site-packages/scipy/maxentropy/maxentropy.py", line 69 from __future__ import division <type 'exceptions.SyntaxError'>: from __future__ imports must occur at the beginning of the file
That problem was easy to fix just by following the instructions of that message in 2 files:
scipy/maxentropy/maxentropy.py scipy/maxentropy/maxentutils.py
Is that import necessary with Python 2.5 or even Python 2.4?
Yes. Integer division will not be changing in the 2.x releases.
I'm checking in a change that moves those statements up, but not before docstrings. I don't have a 2.5 interpreter to check this out with, and I can see no reference to it in the "What's New" documentation, so please let me know if it works for you.
Many thanks, that works fine now. Best regards, Lars
participants (3)
-
David M. Cooke
-
Lars Bittrich
-
Robert Kern