Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71244 > unrolled thread
| Started by | Preethi <preethidasa@gmail.com> |
|---|---|
| First post | 2014-05-10 04:39 -0700 |
| Last post | 2014-05-10 10:41 -0400 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.lang.python
Error while calling round() from future.builtins Preethi <preethidasa@gmail.com> - 2014-05-10 04:39 -0700
Re: Error while calling round() from future.builtins Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-10 11:56 +0000
Re: Error while calling round() from future.builtins Preethi <preethidasa@gmail.com> - 2014-05-12 02:17 -0700
Re: Error while calling round() from future.builtins Jerry Hill <malaclypse2@gmail.com> - 2014-05-10 10:41 -0400
| From | Preethi <preethidasa@gmail.com> |
|---|---|
| Date | 2014-05-10 04:39 -0700 |
| Subject | Error while calling round() from future.builtins |
| Message-ID | <591c2939-7648-47f5-854e-ad254a8a732f@googlegroups.com> |
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:
>>> from future.builtins import int, round
>>> int(round(5))
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
[toc] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2014-05-10 11:56 +0000 |
| Message-ID | <536e1408$0$29980$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #71244 |
On Sat, 10 May 2014 04:39:05 -0700, Preethi wrote: > 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: > >>>> from future.builtins import int, round 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/
[toc] | [prev] | [next] | [standalone]
| From | Preethi <preethidasa@gmail.com> |
|---|---|
| Date | 2014-05-12 02:17 -0700 |
| Message-ID | <d5f55b16-4412-4e83-b728-bcb54718f4ae@googlegroups.com> |
| In reply to | #71245 |
On Saturday, May 10, 2014 5:26:56 PM UTC+5:30, Steven D'Aprano wrote: > On Sat, 10 May 2014 04:39:05 -0700, Preethi wrote: > > > > > 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: > > > > > >>>> from future.builtins import int, round > > > > 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!
[toc] | [prev] | [next] | [standalone]
| From | Jerry Hill <malaclypse2@gmail.com> |
|---|---|
| Date | 2014-05-10 10:41 -0400 |
| Message-ID | <mailman.9849.1399732893.18130.python-list@python.org> |
| In reply to | #71244 |
On Sat, May 10, 2014 at 7:39 AM, Preethi <preethidasa@gmail.com> wrote: > 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. -- Jerry
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web