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

Discussion in 'Python' started by Gabriel Genellina, Dec 8, 2008.

  1. En Fri, 05 Dec 2008 02:31:01 -0200, pk sahoo <>
    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
     
    Gabriel Genellina, Dec 8, 2008
    #1
    1. Advertising

  2. Gabriel Genellina

    John Machin Guest

    Re: getting error...... Traceback (most recent call last): File

    On Dec 8, 6:48 pm, "Gabriel Genellina" <> wrote:
    > En Fri, 05 Dec 2008 02:31:01 -0200, pk sahoo <>  
    > 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
     
    John Machin, Dec 8, 2008
    #2
    1. Advertising

  3. Gabriel Genellina

    JodyGnumeric Guest

    Re: getting error...... Traceback (most recent call last): File

    On Dec 8, 5:54 am, John Machin <> wrote:
    > On Dec 8, 6:48 pm, "Gabriel Genellina" <> wrote:
    >
    >
    >
    > > En Fri, 05 Dec 2008 02:31:01 -0200, pk sahoo <>  
    > > 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'
     
    JodyGnumeric, Dec 9, 2008
    #3
  4. Gabriel Genellina

    John Machin Guest

    Re: getting error...... Traceback (most recent call last): File

    On Dec 9, 12:19 pm, JodyGnumeric <> wrote:
    > On Dec 8, 5:54 am, John Machin <> wrote:
    >
    >
    >
    > > On Dec 8, 6:48 pm, "Gabriel Genellina" <> wrote:

    >
    > > > En Fri, 05 Dec 2008 02:31:01 -0200, pk sahoo <>  
    > > > 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" :-(
     
    John Machin, Dec 9, 2008
    #4
  5. Gabriel Genellina

    JodyGnumeric Guest

    Re: getting error...... Traceback (most recent call last): File

    On Dec 8, 9:02 pm, John Machin <> wrote:
    > On Dec 9, 12:19 pm, JodyGnumeric <> wrote:
    >
    >
    >
    > > On Dec 8, 5:54 am, John Machin <> wrote:

    >
    > > > On Dec 8, 6:48 pm, "Gabriel Genellina" <> wrote:

    >
    > > > > En Fri, 05 Dec 2008 02:31:01 -0200, pk sahoo <>  
    > > > > 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.
     
    JodyGnumeric, Dec 10, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QWxleCBTLg==?=

    Code being Debugged is not most recent

    =?Utf-8?B?QWxleCBTLg==?=, Jan 31, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    308
    =?Utf-8?B?QWxleCBTLg==?=
    Feb 1, 2005
  2. Replies:
    1
    Views:
    859
    Peter Otten
    Oct 12, 2007
  3. Replies:
    0
    Views:
    358
  4. Brian Allen Vanderburg II

    Limit traceback from most recent call

    Brian Allen Vanderburg II, Dec 14, 2008, in forum: Python
    Replies:
    1
    Views:
    306
    Yinon Ehrlich
    Dec 15, 2008
  5. Jack Bates
    Replies:
    0
    Views:
    295
    Jack Bates
    May 2, 2011
Loading...

Share This Page