[BangPypers] xlrd

Shashidhar Paragonda shashidhar85 at gmail.com
Thu Aug 21 15:49:41 CEST 2014


Hi Jayanth,
>>> sorry the files were encrypted, with option available in MS-excel s/w.
They are in read-only mode.
>>> I saw the book.py program of xlrd lib, I dint understood about
verbosity level and all.
>>> is there any changes to be made to book.py ?
>>> thanks in advance.



-----------------------------------
Regards,

Shashidhar N.Paragonda
shashidhar85 at gmail.com
+919900093835


On Thu, Aug 21, 2014 at 5:03 PM, Jayanth Koushik <jnkoushik at gmail.com>
wrote:

> Actually, that might be outdated. I grepped the xlrd source for this
> particular exception. It's raised only from once place: xlrd/book.py:896
> (assuming you're using the latest version: 0.9.3). The particular function
> 'handle_filepass' is weird...:
>
>     def handle_filepass(self, data):
>         if self.verbosity >= 2:
>             logf = self.logfile
>             fprintf(logf, "FILEPASS:\n")
>             hex_char_dump(data, 0, len(data), base=0, fout=logf)
>             if self.biff_version >= 80:
>                 kind1, = unpack('<H', data[:2])
>                 if kind1 == 0: # weak XOR encryption
>                     key, hash_value = unpack('<HH', data[2:])
>                     fprintf(logf,
>                         'weak XOR: key=0x%04x hash=0x%04x\n',
>                         key, hash_value)
>                 elif kind1 == 1:
>                     kind2, = unpack('<H', data[4:6])
>                     if kind2 == 1: # BIFF8 standard encryption
>                         caption = "BIFF8 std"
>                     elif kind2 == 2:
>                         caption = "BIFF8 strong"
>                     else:
>                         caption = "** UNKNOWN ENCRYPTION METHOD **"
>                     fprintf(logf, "%s\n", caption)
>         raise XLRDError("Workbook is encrypted")
>
> Is that function only handling encryption if verbosity is greater than 2?
>
> Jayanth
>
>
>
> On Thu, Aug 21, 2014 at 4:50 PM, Jayanth Koushik <jnkoushik at gmail.com>
> wrote:
>
> > Are you sure the files aren't encrypted? If they are, then xlrd can't
> > handle them.
> >
> > http://www.lexicon.net/sjmachin/README.html (Look at 'Unlikely to be
> > done')
> >
> > Jayanth
> >
> >
> >
> > On Thu, Aug 21, 2014 at 3:26 PM, Shashidhar Paragonda <
> > shashidhar85 at gmail.com> wrote:
> >
> >> Hello all,
> >> >>> I am using xlrd library to read .xls files,
> >> >>> wb = xlrd.open_workbook("workbook_name.xls")
> >> >>> when I execute I get error :
> >>
> >> Traceback (most recent call last):
> >>   File "rater_document_parser.py", line 72, in <module>
> >>     wb = xlrd.open_workbook(row.SERVER_MOUNT_PATH)
> >>   File "/usr/lib/python2.6/site-packages/xlrd/__init__.py", line 435, in
> >> open_workbook
> >>     ragged_rows=ragged_rows,
> >>   File "/usr/lib/python2.6/site-packages/xlrd/book.py", line 116, in
> >> open_workbook_xls
> >>     bk.parse_globals()
> >>   File "/usr/lib/python2.6/site-packages/xlrd/book.py", line 1178, in
> >> parse_globals
> >>     self.handle_filepass(data)
> >>   File "/usr/lib/python2.6/site-packages/xlrd/book.py", line 896, in
> >> handle_filepass
> >>     raise XLRDError("Workbook is encrypted")
> >> xlrd.biffh.XLRDError: Workbook is encrypted
> >>
> >> >>> when I manually open, it open
> >> >>> any suggession on resolving this error.
> >> >>>Thank you.
> >>
> >>
> >>
> >> -----------------------------------
> >> Regards,
> >>
> >> Shashidhar N.Paragonda
> >> shashidhar85 at gmail.com
> >> +919900093835
> >> _______________________________________________
> >> BangPypers mailing list
> >> BangPypers at python.org
> >> https://mail.python.org/mailman/listinfo/bangpypers
> >>
> >
> >
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> https://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list