Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: getting error...... Traceback (most recent call last): File"<stdin>", line 1, in <module> File

Reply
Thread Tools

Re: getting error...... Traceback (most recent call last): File"<stdin>", line 1, in <module> File

 
 
Gabriel Genellina
Guest
Posts: n/a
 
      12-08-2008
En Fri, 05 Dec 2008 02:31:01 -0200, pk sahoo <(E-Mail Removed)>
escribió:

> hallo everybody,
> when i am running the following command
>
>>>> import xlrd
>>>> book=xlrd.open_workbook("C:\\a.xls")

>
> i am getting the following error..
>
>
> *Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "C:\Python25\Lib\site-packages\xlrd\__init__.py", line 370, in
> open_workb
> ook
> biff_version = bk.getbof(XL_WORKBOOK_GLOBALS)
> File "C:\Python25\Lib\site-packages\xlrd\__init__.py", line 1323, in
> getbof
> raise XLRDError('Expected BOF record; found 0x%04x' % opcode)
> xlrd.biffh.XLRDError: Expected BOF record; found 0x3f3c*


Looks like your a.xls file is not an Excel file (one of the formats
supported by xlrd).
As 0x3f3c corresponds to the characters '<?' you probably have an XML file.

--
Gabriel Genellina

 
Reply With Quote
 
 
 
 
John Machin
Guest
Posts: n/a
 
      12-08-2008
On Dec 8, 6:48*pm, "Gabriel Genellina" <(E-Mail Removed)> wrote:
> En Fri, 05 Dec 2008 02:31:01 -0200, pk sahoo <(E-Mail Removed)> *
> escribió:
>
>
>
> > hallo everybody,
> > when i am running the following command

>
> >>>> import xlrd
> >>>> book=xlrd.open_workbook("C:\\a.xls")

>
> > i am getting the following error..

>
> > *Traceback (most recent call last):
> > * File "<stdin>", line 1, in <module>
> > * File "C:\Python25\Lib\site-packages\xlrd\__init__.py", line 370, in
> > open_workb
> > ook
> > * * biff_version = bk.getbof(XL_WORKBOOK_GLOBALS)
> > * File "C:\Python25\Lib\site-packages\xlrd\__init__.py", line 1323, in
> > getbof
> > * * raise XLRDError('Expected BOF record; found 0x%04x' % opcode)
> > xlrd.biffh.XLRDError: Expected BOF record; found 0x3f3c*

>
> Looks like your a.xls file is not an Excel file (one of the formats *
> supported by xlrd).
> As 0x3f3c corresponds to the characters '<?' you probably have an XML file.


This can be verified easily by opening the file with a simple-minded
text editor (e.g. Notepad) ... if the first two lines are
"""
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
"""
then it's an Excel 2003 XML Spreadsheet that's been manually(?)
renamed from .xml to .xls.

The current xlrd release supports only the binary ("BIFF") format .xls
files created by Excel 3.0 to Excel 2003. The next release (due out
Real Soon Now) will support Excel 2.1 and 2.0 formats [don't ask].
Very soon after that will come support for Excel 2007 .xlsx which is a
bunch of XML files inside a ZIP file. Support for Excel 2003
"SpreadsheetML" is way down the to-do list.

If the OP wants to be able to read the file with xlrd:
(1) Open it with Excel 200[37] and save as a .xls file
or (2) rename it to .xml, start OpenOffice.org Calc, click on File,
click on Open, click on "Files of type", choose "Microsoft Excel 2003
XML (*.xml)" from the (long, unsorted) drop-down list, ..., and save
as etc etc. Gnumeric is not an option.

HTH,
John



 
Reply With Quote
 
 
 
 
JodyGnumeric
Guest
Posts: n/a
 
      12-09-2008
On Dec 8, 5:54*am, John Machin <(E-Mail Removed)> wrote:
> On Dec 8, 6:48*pm, "Gabriel Genellina" <(E-Mail Removed)> wrote:
>
>
>
> > En Fri, 05 Dec 2008 02:31:01 -0200, pk sahoo <(E-Mail Removed)> *
> > escribió:

>
> > > hallo everybody,
> > > when i am running the following command

>
> > >>>> import xlrd
> > >>>> book=xlrd.open_workbook("C:\\a.xls")

>
> > > i am getting the following error..

>
> > > *Traceback (most recent call last):
> > > * File "<stdin>", line 1, in <module>
> > > * File "C:\Python25\Lib\site-packages\xlrd\__init__.py", line 370, in
> > > open_workb
> > > ook
> > > * * biff_version = bk.getbof(XL_WORKBOOK_GLOBALS)
> > > * File "C:\Python25\Lib\site-packages\xlrd\__init__.py", line 1323, in
> > > getbof
> > > * * raise XLRDError('Expected BOF record; found 0x%04x' % opcode)
> > > xlrd.biffh.XLRDError: Expected BOF record; found 0x3f3c*

>
> > Looks like your a.xls file is not an Excel file (one of the formats *
> > supported by xlrd).
> > As 0x3f3c corresponds to the characters '<?' you probably have an XML file.

>
> This can be verified easily by opening the file with a simple-minded
> text editor (e.g. Notepad) ... if the first two lines are
> """
> <?xml version="1.0"?>
> <?mso-application progid="Excel.Sheet"?>
> """
> then it's an Excel 2003 XML Spreadsheet that's been manually(?)
> renamed from .xml to .xls.
>
> The current xlrd release supports only the binary ("BIFF") format .xls
> files created by Excel 3.0 to Excel 2003. The next release (due out
> Real Soon Now) will support Excel 2.1 and 2.0 formats [don't ask].
> Very soon after that will come support for Excel 2007 .xlsx which is a
> bunch of XML files inside a ZIP file. Support for Excel 2003
> "SpreadsheetML" is way down the to-do list.
>
> If the OP wants to be able to read the file with xlrd:
> (1) Open it with Excel 200[37] and save as a .xls file
> or (2) rename it to .xml, start OpenOffice.org Calc, click on File,
> click on Open, click on "Files of type", choose "Microsoft Excel 2003
> XML (*.xml)" from the (long, unsorted) drop-down list, ..., and save
> as etc etc. Gnumeric is not an option.
>
> HTH,
> John


Gnumeric can read this format. 'MS Excel (tm) 2003 SpreadsheetML'
 
Reply With Quote
 
John Machin
Guest
Posts: n/a
 
      12-09-2008
On Dec 9, 12:19*pm, JodyGnumeric <(E-Mail Removed)> wrote:
> On Dec 8, 5:54*am, John Machin <(E-Mail Removed)> wrote:
>
>
>
> > On Dec 8, 6:48*pm, "Gabriel Genellina" <(E-Mail Removed)> wrote:

>
> > > En Fri, 05 Dec 2008 02:31:01 -0200, pk sahoo <(E-Mail Removed)> *
> > > escribió:

>
> > > > hallo everybody,
> > > > when i am running the following command

>
> > > >>>> import xlrd
> > > >>>> book=xlrd.open_workbook("C:\\a.xls")

>
> > > > i am getting the following error..

>
> > > > *Traceback (most recent call last):
> > > > * File "<stdin>", line 1, in <module>
> > > > * File "C:\Python25\Lib\site-packages\xlrd\__init__.py", line 370, in
> > > > open_workb
> > > > ook
> > > > * * biff_version = bk.getbof(XL_WORKBOOK_GLOBALS)
> > > > * File "C:\Python25\Lib\site-packages\xlrd\__init__.py", line 1323, in
> > > > getbof
> > > > * * raise XLRDError('Expected BOF record; found 0x%04x' % opcode)
> > > > xlrd.biffh.XLRDError: Expected BOF record; found 0x3f3c*

>
> > > Looks like your a.xls file is not an Excel file (one of the formats *
> > > supported by xlrd).
> > > As 0x3f3c corresponds to the characters '<?' you probably have an XML file.

>
> > This can be verified easily by opening the file with a simple-minded
> > text editor (e.g. Notepad) ... if the first two lines are
> > """
> > <?xml version="1.0"?>
> > <?mso-application progid="Excel.Sheet"?>
> > """
> > then it's an Excel 2003 XML Spreadsheet that's been manually(?)
> > renamed from .xml to .xls.

>
> > The current xlrd release supports only the binary ("BIFF") format .xls
> > files created by Excel 3.0 to Excel 2003. The next release (due out
> > Real Soon Now) will support Excel 2.1 and 2.0 formats [don't ask].
> > Very soon after that will come support for Excel 2007 .xlsx which is a
> > bunch of XML files inside a ZIP file. Support for Excel 2003
> > "SpreadsheetML" is way down the to-do list.

>
> > If the OP wants to be able to read the file with xlrd:
> > (1) Open it with Excel 200[37] and save as a .xls file
> > or (2) rename it to .xml, start OpenOffice.org Calc, click on File,
> > click on Open, click on "Files of type", choose "Microsoft Excel 2003
> > XML (*.xml)" from the (long, unsorted) drop-down list, ..., and save
> > as etc etc. Gnumeric is not an option.

>
> > HTH,
> > John

>
> Gnumeric can read this format. 'MS Excel (tm) 2003 SpreadsheetML'


[Gnumeric 1.9.1 on Windows XP]

I'm sorry; I thought I'd exhausted every possible way of trying to
open it. After looking at the file open dialogue box again, I've
spotted the "Advanced" button. Here is what you need to do:

Have the file named whatever.xls. Click on File / Open , navigate to
correct directory, click on Advanced, choose 'MS Excel (tm) 2003
SpreadsheetML' from the File-type drop-down list, choose the file,
click on OK. Anything else (Simple (non-Advanced), naming it
whatever.xml, ...) produces no response, yes that's zero bits of
information, not even a Bzzzzt! noise

*AND* when it does open up, a date cell defined by
<Style ss:ID="s21">
<NumberFormat ss:Format="Short Date"/>
</Style>
....
<Cell ss:StyleID="s21"><Data
ss:Type="DateTime">1999-12-31T00:00:00.000</Data></Cell>

is displayed as "00ort 31at1999"
 
Reply With Quote
 
JodyGnumeric
Guest
Posts: n/a
 
      12-10-2008
On Dec 8, 9:02*pm, John Machin <(E-Mail Removed)> wrote:
> On Dec 9, 12:19*pm, JodyGnumeric <(E-Mail Removed)> wrote:
>
>
>
> > On Dec 8, 5:54*am, John Machin <(E-Mail Removed)> wrote:

>
> > > On Dec 8, 6:48*pm, "Gabriel Genellina" <(E-Mail Removed)> wrote:

>
> > > > En Fri, 05 Dec 2008 02:31:01 -0200, pk sahoo <(E-Mail Removed)> *
> > > > escribió:

>
> > > > > hallo everybody,
> > > > > when i am running the following command

>
> > > > >>>> import xlrd
> > > > >>>> book=xlrd.open_workbook("C:\\a.xls")

>
> > > > > i am getting the following error..

>
> > > > > *Traceback (most recent call last):
> > > > > * File "<stdin>", line 1, in <module>
> > > > > * File "C:\Python25\Lib\site-packages\xlrd\__init__.py", line 370, in
> > > > > open_workb
> > > > > ook
> > > > > * * biff_version = bk.getbof(XL_WORKBOOK_GLOBALS)
> > > > > * File "C:\Python25\Lib\site-packages\xlrd\__init__.py", line 1323, in
> > > > > getbof
> > > > > * * raise XLRDError('Expected BOF record; found 0x%04x' % opcode)
> > > > > xlrd.biffh.XLRDError: Expected BOF record; found 0x3f3c*

>
> > > > Looks like your a.xls file is not an Excel file (one of the formats *
> > > > supported by xlrd).
> > > > As 0x3f3c corresponds to the characters '<?' you probably have an XML file.

>
> > > This can be verified easily by opening the file with a simple-minded
> > > text editor (e.g. Notepad) ... if the first two lines are
> > > """
> > > <?xml version="1.0"?>
> > > <?mso-application progid="Excel.Sheet"?>
> > > """
> > > then it's an Excel 2003 XML Spreadsheet that's been manually(?)
> > > renamed from .xml to .xls.

>
> > > The current xlrd release supports only the binary ("BIFF") format .xls
> > > files created by Excel 3.0 to Excel 2003. The next release (due out
> > > Real Soon Now) will support Excel 2.1 and 2.0 formats [don't ask].
> > > Very soon after that will come support for Excel 2007 .xlsx which is a
> > > bunch of XML files inside a ZIP file. Support for Excel 2003
> > > "SpreadsheetML" is way down the to-do list.

>
> > > If the OP wants to be able to read the file with xlrd:
> > > (1) Open it with Excel 200[37] and save as a .xls file
> > > or (2) rename it to .xml, start OpenOffice.org Calc, click on File,
> > > click on Open, click on "Files of type", choose "Microsoft Excel 2003
> > > XML (*.xml)" from the (long, unsorted) drop-down list, ..., and save
> > > as etc etc. Gnumeric is not an option.

>
> > > HTH,
> > > John

>
> > Gnumeric can read this format. 'MS Excel (tm) 2003 SpreadsheetML'

>
> [Gnumeric 1.9.1 on Windows XP]
>
> I'm sorry; I thought I'd exhausted every possible way of trying to
> open it. After looking at the file open dialogue box again, I've
> spotted the "Advanced" button. Here is what you need to do:
>
> Have the file named whatever.xls. Click on File / Open , navigate to
> correct directory, click on Advanced, choose 'MS Excel (tm) 2003
> SpreadsheetML' from the File-type drop-down list, choose the file,
> click on OK. Anything else (Simple (non-Advanced), naming it
> whatever.xml, ...) produces no response, yes that's zero bits of
> information, not even a Bzzzzt! noise
>
> *AND* when it does open up, a date cell defined by
> * <Style ss:ID="s21">
> * *<NumberFormat ss:Format="Short Date"/>
> * </Style>
> ...
> <Cell ss:StyleID="s21"><Data
> ss:Type="DateTime">1999-12-31T00:00:00.000</Data></Cell>
>
> is displayed as "00ort 31at1999"


Please send the file to bugzilla.gnome.org it sounds like I need to
improve the probe function function for this format and add support
for the magic named formats.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"raise (type, value, traceback)" and "raise type, value, traceback" Jack Bates Python 0 05-02-2011 05:23 PM
Limit traceback from most recent call Brian Allen Vanderburg II Python 1 12-15-2008 01:29 PM
Traceback (most recent call last): PROBLEM smarras@bsc.es Python 1 10-12-2007 01:38 PM
Traceback (most recent call last): PROBLEM smarras@bsc.es Python 0 10-12-2007 12:59 PM
>>> python test1.py / Traceback ( File "<interactive input>", line 1 leroybt.rm Python 2 11-26-2003 01:35 AM



Advertisments