I try to open 100 pdf files with python 2.7 with this code:
import arcpy,fnmatch,os
rootPath = r"D:\desktop"
pattern = '*.pdf'
counter = 0
for root, dirs, files in os.walk(rootPath):
for filename in fnmatch.filter(files, pattern):
os.startfile(rootPath)
counter = counter + 1
print counter
as a result the rootPath folder opened and python print the number of pdf files:
>>>
39
>>>
No pdf files opened. I search in the forum and didn't find any question with answers to my request. Thanks for any help
rootPathreturns you the name of the PDF file? I see you defind rootPath asD:\desktopand its not even the name of the PDF you're trying to openD:\desktopbecomesD:\\desktop) , and try:import os; os.startfile(pdf_file_path). Does Adobe reader / other PDF viewer come up? If not, the MIME type registry is suspect.