ozzyx123 0 Newbie Poster

hi everyone i am very new to programming and really need some advice.
i am currently building a program and one of the things i need is to be able to count the number of pages in pdf files in a directory. i found a script online which is suppose to do that but for some reason i can get it to work. im not completly sure what i have to change in the script for it to work for me could someone please help me and tell me what i have to change in the script to be able to get this to work for me. when i change the vPath to the path of the directory where the pdf files are located, the program doesnt run but when i dont change anything the program doesnt return anything.

i want my program to be anle to return the number of pages of each of the pdf files in a directory.
i already made a program which only counts the number o pages in just one pdf but i need something to be able to count the number of pages of each of the pdf files in a directory

i want the return to look something like this:

D:\Kits\PDF\pdftk_v1.12\CEB_fara_PCP.pdf : [5217] pag.
D:\Kits\PDF\pdftk_v1.12\CEB_cu_PCP.pdf : [974] pag.
D:\Kits\PDF\pdftk_v1.12\CEC.pdf : [2] pag.
D:\Kits\PDF\pdftk_v1.12\ABN.pdf : [16] pag.

"""
This module contains a function to count
the total pages for all PDF files in one directory.
"""

#from time import clock as __c #Used for benchmark.
from glob import glob as __g
from re import search as __s

def count( vPath ):
	"""
	Takes one argument: the path where you want to search the files.
	Returns a dictionary with the file name and number of pages for each file.
	"""
	#
	#cdef double ti = __c() #Used for benchmark.
	#
	vPDFfiles = __g( vPath + "\\" + '*.pdf' )
	vPages = 0
	vMsg = {}
	#
	for vPDFfile in vPDFfiles:
		vFileOpen = open( vPDFfile, 'rb', 1 )

		for vLine in vFileOpen.readlines():
			if "/Count " in vLine:
				vPages = int( __s("/Count \d*", vLine).group()[7:] )

		vMsg[vPDFfile] = vPages
		vFileOpen.close()
	#
	#cdef double tf = __c() #Used for benchmark.
	#
	#print tf-ti
	return vMsg
	#