更新时间:2022-11-05 15:36:53
我是个白痴.
I'm an idiot.
"C:\\Users\\User\Desktop\test.pdf"
是无效的路径,因为\ test.pdf中的\ t被解释为制表符... 将更改添加到\ test.pdf后,它可以工作.
is an invalid path because the \t in \test.pdf is interpretted as a tab... It works after adding changing it to \test.pdf.
以后有相同问题的任何人的代码:
Code for anyone with the same problem later:
import os
import subprocess
page = "3"
path_to_pdf = os.path.abspath("C:\\Users\\User\Desktop\\test.pdf")
path_to_acrobat = os.path.abspath('C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe')
process = subprocess.Popen([path_to_acrobat, '/n', '/A', 'page=' + page, path_to_pdf], shell=False, stdout=subprocess.PIPE)
process.wait()