python error can't open pdf in application from python

Viewed 1999

I am using windows 10 and python 2.7.13 . My target is to open a pdf in acrobat reader at a specific page number. I am using the code I received from one of the questions in the forum here.

import subprocess
import os

path_to_pdf = os.path.abspath('C:\test_file.pdf')
# I am testing this on my Windows Install machine
path_to_acrobat = os.path.abspath('C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe') 

# this will open your document on page 12
process = subprocess.Popen([path_to_acrobat, '/A', 'page=12', path_to_pdf], shell=False, stdout=subprocess.PIPE)
process.wait()

It opens up the acrobat reader application but the file doesnt open and i get the error :"There was an error opening this document. The filename, directory name, or volume label syntax is incorrect

but when I use these commands in cmd without python I am successfully able to open the pdf without any error. Please help.

2 Answers
Related