you have to read the contents of the file:
data = open("/home/suleiman/Desktop/CVE-2011-2462_36EE5F9C51316E060657AA86D48670E8","rb").read()
Pregunta
I have a problem when I use this code to count the number of pages in pdf file :
if j[i].rstrip() == "Page" or j[i].rstrip() == "page":
rxcountpages = re.compile(r"/Type\s*/Page([^s]|$)", re.MULTILINE|re.DOTALL)
data = file("/home/suleiman/Desktop/CVE-2011-2462_36EE5F9C51316E060657AA86D48670E8","rb")
print len(rxcountpages.findall(data))
the error is:
Traceback (most recent call last): File "pdf_scanner.py", line 89, in
main()
File "pdf_scanner.py", line 72, in main
print len(rxcountpages.findall(data))
TypeError: expected string or buffer
can an one help me with it?
Solución
you have to read the contents of the file:
data = open("/home/suleiman/Desktop/CVE-2011-2462_36EE5F9C51316E060657AA86D48670E8","rb").read()