From: John Machin on
On Jan 9, 9:56 pm, pp <parul.pande...(a)gmail.com> wrote:
> On Jan 9, 3:52 am, Jon Clements <jon...(a)googlemail.com> wrote:
>
>
>
> > On Jan 9, 10:44 am, pp <parul.pande...(a)gmail.com> wrote:
>
> > > On Jan 9, 3:42 am, Jon Clements <jon...(a)googlemail.com> wrote:
>
> > > > On Jan 9, 10:24 am, pp <parul.pande...(a)gmail.com> wrote:

> > > yeah all my versions are latest fromhttp://www.python-excel.org.
> > > just checked!!

How did you check?

> > > what could be the problem?
>
> > Does rb = xlrd.open_workbook('somesheet.xls', on_demand=True) work by
> > itself?
>
> Yes it does. The problem is with line: wb =  copy(rb)
> here I am getting the error: AttributeError: 'Book' object has no
> attribute 'on_demand'

Please replace the first 4 lines of your script by these 6 lines:

import xlrd
assert xlrd.__VERSION__ == "0.7.1"
from xlwt import easyxf
from xlutils.copy import copy
rb = xlrd.open_workbook(
'source.xls',formatting_info=True, on_demand=False)

and run it again. Please copy all the output and paste it into your
response.

From: pp on
On Jan 9, 8:23 am, John Machin <sjmac...(a)lexicon.net> wrote:
> On Jan 9, 9:56 pm, pp <parul.pande...(a)gmail.com> wrote:
>
> > On Jan 9, 3:52 am, Jon Clements <jon...(a)googlemail.com> wrote:
>
> > > On Jan 9, 10:44 am, pp <parul.pande...(a)gmail.com> wrote:
>
> > > > On Jan 9, 3:42 am, Jon Clements <jon...(a)googlemail.com> wrote:
>
> > > > > On Jan 9, 10:24 am, pp <parul.pande...(a)gmail.com> wrote:
> > > > yeah all my versions are latest fromhttp://www.python-excel.org.
> > > > just checked!!
>
> How did you check?
>
> > > > what could be the problem?
>
> > > Does rb = xlrd.open_workbook('somesheet.xls', on_demand=True) work by
> > > itself?
>
> > Yes it does. The problem is with line: wb =  copy(rb)
> > here I am getting the error: AttributeError: 'Book' object has no
> > attribute 'on_demand'
>
> Please replace the first 4 lines of your script by these 6 lines:
>
> import xlrd
> assert xlrd.__VERSION__ == "0.7.1"
> from xlwt import easyxf
> from xlutils.copy import copy
> rb = xlrd.open_workbook(
>     'source.xls',formatting_info=True, on_demand=False)
>
> and run it again. Please copy all the output and paste it into your
> response.

This time when I ran the code sent by you I got the following
results:I am using ipython for running the code.

AssertionError Traceback (most recent call
last)

/home/parul/CODES/copy_1.py in <module>()
1
----> 2 import xlrd
3 assert xlrd.__VERSION__ == "0.7.1"
4 from xlwt import easyxf
5 from xlutils.copy import copy
6 rb = xlrd.open_workbook('source.xls',formatting_info=True,
on_demand=False)

AssertionError:
WARNING: Failure executing file: <copy_1.py>

I used www.python-excel.org to get xlrd and xlwt .. so they are latest
versions.
From: John Machin on
On Jan 10, 8:51 pm, pp <parul.pande...(a)gmail.com> wrote:
> On Jan 9, 8:23 am, John Machin <sjmac...(a)lexicon.net> wrote:
>
>
>
> > On Jan 9, 9:56 pm, pp <parul.pande...(a)gmail.com> wrote:
>
> > > On Jan 9, 3:52 am, Jon Clements <jon...(a)googlemail.com> wrote:
>
> > > > On Jan 9, 10:44 am, pp <parul.pande...(a)gmail.com> wrote:
>
> > > > > On Jan 9, 3:42 am, Jon Clements <jon...(a)googlemail.com> wrote:
>
> > > > > > On Jan 9, 10:24 am, pp <parul.pande...(a)gmail.com> wrote:
> > > > > yeah all my versions are latest fromhttp://www.python-excel.org.
> > > > > just checked!!
>
> > How did you check?

You didn't answer this question.

>
> > > > > what could be the problem?
>
> > > > Does rb = xlrd.open_workbook('somesheet.xls', on_demand=True) work by
> > > > itself?
>
> > > Yes it does. The problem is with line: wb =  copy(rb)
> > > here I am getting the error: AttributeError: 'Book' object has no
> > > attribute 'on_demand'
>
> > Please replace the first 4 lines of your script by these 6 lines:
>
> > import xlrd
> > assert xlrd.__VERSION__ == "0.7.1"
> > from xlwt import easyxf
> > from xlutils.copy import copy
> > rb = xlrd.open_workbook(
> >     'source.xls',formatting_info=True, on_demand=False)
>
> > and run it again. Please copy all the output and paste it into your
> > response.
>
> This time when I ran the code sent by you I got the following
> results:I am using ipython for running the code.
>
> AssertionError                            Traceback (most recent call
> last)
>
> /home/parul/CODES/copy_1.py in <module>()
>       1
> ----> 2 import xlrd
>       3 assert xlrd.__VERSION__ == "0.7.1"
>       4 from xlwt import easyxf
>       5 from xlutils.copy import copy
>       6 rb = xlrd.open_workbook('source.xls',formatting_info=True,
> on_demand=False)
>
> AssertionError:
> WARNING: Failure executing file: <copy_1.py>
>

Your traceback appears to show an AssertionError from an import
statement. We could do without an extra layer of noise in the channel;
please consider giving ipython the flick (for debug purposes, at
least) and use Python to run your script from the shell prompt.

Change the second line to read:

print xlrd.__VERSION__

> I used www.python-excel.org to get xlrd and xlwt .. so they are latest
> versions.

Let's concentrate on xlrd. I presume that means that you clicked
on the xlrd Download link which took you to http://pypi.python.org/pypi/xlrd
from which you can download the latest version of the package. That
page has "xlrd 0.7.1" in a relatively large font at the top. You would
have been presented with options to download one of these

xlrd-0.7.1.tar.gz
xlrd-0.7.1.win32.exe
xlrd-0.7.1.zip

(each uploaded on 2009-06-01).

Which one did you download, and then what did you do with it?

Or perhaps you ignored those and read further down to "Download link"
which took you to an out-of-date page but you didn't notice the
"0.6.1" in large bold type at the top nor the "Page last updated on 11
June 2007" at the bottom nor the "0.6.1" in the name of the file that
you downloaded ... sorry about that; I've smacked the webmaster about
the chops :-)

Cheers,
John
First  |  Prev  | 
Pages: 1 2
Prev: Append to an Excel file
Next: Something More Elegant