ralsina / pdfrw

Automatically exported from code.google.com/p/pdfrw
Other
0 stars 0 forks source link

'int' object is not callable #10

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
attempting to run the following line of code:
pages[0].MediaBox[2:]

would result in something like:

Traceback (most recent call last):
  File "/tp/new_backend/teampatent/test/test_pdfwrap.py", line 233, in test_pdfwrap_page_sizes
    eq_([420, 595], [int(n) for n in pages[0].MediaBox[2:]])
  File "build/bdist.linux-i686/egg/pdfrw/objects/pdfarray.py", line 39, in __getslice__
    return listget(self, index)
TypeError: 'int' object is not callable

this used to work before 0.1 release

Original issue reported on code.google.com by liucou...@gmail.com on 5 Mar 2013 at 1:21

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
it seems changing __getslice__ to the following should fix this:

    def __getslice__(self, i, j, listget=list.__getslice__):
        self._resolve()
        return listget(self, i, j)

Original comment by liucou...@gmail.com on 5 Mar 2013 at 1:33