Error while calling round() from future.builtins

P

Preethi

Hi,

I am new to python. I am getting an error "AttributeError: type object 'Decimal' has no attribute 'from_float'" when I run the following in python prompt:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/site-packages/future/builtins/backports/newround.py", line 32, in newround
d = Decimal.from_float(number).quantize(exponent,
AttributeError: type object 'Decimal' has no attribute 'from_float'

I am running this on Centos 6.5 which has python version 2.6.6
This is the output of 'pip freeze':

Django==1.6.4
Mezzanine==3.1.4
Pillow==2.4.0
South==0.8.4
bleach==1.4
django-appconf==0.6
django-compressor==1.3
filebrowser-safe==0.3.3
future==0.9.0
grappelli-safe==0.3.10
html5lib==0.999
iniparse==0.3.1
oauthlib==0.6.1
psycopg2==2.5.2
pycurl==7.19.0
pygpgme==0.1
pytz==2014.2
requests==2.2.1
requests-oauthlib==0.4.0
six==1.6.1
tzlocal==1.0
urlgrabber==3.9.1
yum-metadata-parser==1.1.2

This is the order in which I installed the above packages. (The box initially had python 2.6.6 installed)

yum install gcc python python-setuptools python-devel
yum install libjpeg-turbo-devel
python get-pip.py
pip install -U pip
pip install South django-compressor
pip install mezzanine
yum install postgresql93-server.x86_64
yum install postgresql-devel
sudo pip install psycopg2

What am I missing? Any help is greatly appreciated.

Thanks,
Preethi
 
S

Steven D'Aprano

Hi,

I am new to python. I am getting an error "AttributeError: type object
'Decimal' has no attribute 'from_float'" when I run the following in
python prompt:

I get an error when I try that:


py> from future.builtins import int, round
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named future.builtins


Perhaps you are using the third-party library "future"?

https://pypi.python.org/pypi/future

If so, then I believe the library is buggy and you should report it to
the Centos package maintainer. You might also manually install a more
recent version of future.

Decimal.from_float was only added in 2.7, it is not available in 2.6.

https://docs.python.org/2/library/decimal.html#decimal.Decimal.from_float
 
J

Jerry Hill

future==0.9.0

It looks like that library is out of date. The current version looks
to be 0.12.0, and it also looks like this bug was fixed in the 0.12.0
release. I'd upgrade your version if at all possible.
 
P

Preethi

I get an error when I try that:





py> from future.builtins import int, round

Traceback (most recent call last):

File "<stdin>", line 1, in <module>

ImportError: No module named future.builtins





Perhaps you are using the third-party library "future"?



https://pypi.python.org/pypi/future



If so, then I believe the library is buggy and you should report it to

the Centos package maintainer. You might also manually install a more

recent version of future.



Decimal.from_float was only added in 2.7, it is not available in 2.6.



https://docs.python.org/2/library/decimal.html#decimal.Decimal.from_float









--

Steven D'Aprano

http://import-that.dreamwidth.org/

Yes, I upgraded to 0.12.0 and it worked! Thanks a lot!
 

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top