Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #93007

Re: Opening PDF Using subprocess.Popen Failing

X-Received by 10.182.4.98 with SMTP id j2mr39041671obj.41.1434983020440; Mon, 22 Jun 2015 07:23:40 -0700 (PDT)
X-Received by 10.140.109.35 with SMTP id k32mr3875qgf.34.1434983020412; Mon, 22 Jun 2015 07:23:40 -0700 (PDT)
Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!j8no168595igd.0!news-out.google.com!4ni2484qgh.1!nntp.google.com!q107no2660712qgd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Mon, 22 Jun 2015 07:23:40 -0700 (PDT)
In-Reply-To <4857b9a4-386f-4ae4-861b-09a9564557c7@googlegroups.com>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=24.187.242.98; posting-account=a1X1egoAAAC_bQvAs1XfQ4Hf-9GYrPo0
NNTP-Posting-Host 24.187.242.98
References <4857b9a4-386f-4ae4-861b-09a9564557c7@googlegroups.com>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <63ba19bd-e13e-4e5e-9d1d-2fe6392cb12e@googlegroups.com> (permalink)
Subject Re: Opening PDF Using subprocess.Popen Failing
From Naftali <nmichalowsky@gmail.com>
Injection-Date Mon, 22 Jun 2015 14:23:40 +0000
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Xref csiph.com comp.lang.python:93007

Show key headers only | View raw


On Friday, June 19, 2015 at 1:25:12 PM UTC-4, Naftali wrote:
> It actually doesn't fail but it 'cannot open in protected mode' (see here http://blogs.adobe.com/dmcmahon/2012/07/27/adobe-reader-cannot-open-protected-mode-due-to-a-problem-with-your-system-configuration/)
> 
> I am using subprocess.Popen("AcroRe32.exe /n <file.pdf>") which is the actuall adobe reader command I'd issue on the command line to open the pdf (the /n option opens it the file in a new instance of reader).
> 
> Now, when I issue the command straight from powershell, the pdf opens no problem, but when I open in my script (whether a .py or py2exe) I get the pop up complaining that the PDF cannot be opened in 'protected mode.' One of the options is to open it anyways, which works. 
> 
> Looking into it (see the link in the first paragraph) my best guess is that it's due to something like "JS-invoked processes: Launching a process through JavaScript is not allowed with Protected Mode enabled." 
> 
> But my naive understanding was that when I give Popen instruction, the command is handed off to windows and the called program is unaware of how it got called, so my thinking is that either that is incorrect or windows somehow 'cooperates' with reader to figure things out. 
> 
> I am looking for *any* insight as to how to deal with this, and the 'turn off protected mode" option wont work for me. 
> 
> Here is my code,
> 
> outputname = " unlocked.pdf"
> 
> commandstr = "qpdf --decrypt " + sys.argv[1] + outputname
> os.system(commandstr)
> 
> new_command_str = "AcroRd32.exe /n" + outputname
> subprocess.Popen(new_command_str)
> 
> sys.exit(0)

Sadly so far it looks like the only answer is to disable protected mode, either generally or on a my app basis, which is the same thing because my app will be registered as the default handler for pdf. So this is a deal breaker. I've even tried routing the opening through a bat file... so either I get this to open up in protected mode or I don't see anyway to make it go, with out using a different reader. But thank you all for your help, will update should I have any success in this.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Opening PDF Using subprocess.Popen Failing Naftali <nmichalowsky@gmail.com> - 2015-06-19 10:24 -0700
  Re: Opening PDF Using subprocess.Popen Failing Laura Creighton <lac@openend.se> - 2015-06-19 20:17 +0200
  Re: Opening PDF Using subprocess.Popen Failing Naftali <nmichalowsky@gmail.com> - 2015-06-19 11:45 -0700
  Re: Opening PDF Using subprocess.Popen Failing Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-06-20 09:50 -0400
  Re: Opening PDF Using subprocess.Popen Failing Naftali <nmichalowsky@gmail.com> - 2015-06-20 20:14 -0700
    Re: Opening PDF Using subprocess.Popen Failing Robin Becker <robin@reportlab.com> - 2015-06-22 11:33 +0100
    Re: Opening PDF Using subprocess.Popen Failing Robin Becker <robin@reportlab.com> - 2015-06-22 11:55 +0100
  Re: Opening PDF Using subprocess.Popen Failing Naftali <nmichalowsky@gmail.com> - 2015-06-22 06:15 -0700
    Re: Opening PDF Using subprocess.Popen Failing Laura Creighton <lac@openend.se> - 2015-06-22 15:37 +0200
  Re: Opening PDF Using subprocess.Popen Failing Naftali <nmichalowsky@gmail.com> - 2015-06-22 07:23 -0700
  Re: Opening PDF Using subprocess.Popen Failing Naftali <nmichalowsky@gmail.com> - 2015-06-22 09:13 -0700

csiph-web