Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'pop': 0.05; 'subject:skip:s 10': 0.05; 'works.': 0.07; 'complaining': 0.09; 'incorrect': 0.09; 'received:openend.se': 0.09; 'received:theraft.openend.se': 0.09; 'cc:addr:python-list': 0.10; 'url:)': 0.14; 'output': 0.15; '*any*': 0.16; '.py': 0.16; 'anyways,': 0.16; 'called,': 0.16; 'cc:addr:lac': 0.16; 'cc:addr:openend.se': 0.16; 'entry:': 0.16; 'from:addr:lac': 0.16; 'from:addr:openend.se': 0.16; 'from:name:laura creighton': 0.16; 'instruction,': 0.16; 'message-id:@fido.openend.se': 0.16; 'naive': 0.16; 'received:89.233': 0.16; 'received:89.233.217': 0.16; 'received:89.233.217.133': 0.16; 'received:fido': 0.16; 'received:fido.openend.se': 0.16; 'skip:> 20': 0.16; 'subject:Opening': 0.16; 'url:adobe': 0.16; 'url:blogs': 0.16; 'workflows,': 0.16; 'later': 0.16; 'laura': 0.18; 'windows': 0.20; '(see': 0.20; 'cc:addr:python.org': 0.21; '(the': 0.22; 'cc:2**1': 0.22; 'code,': 0.23; '2015': 0.23; "haven't": 0.24; 'seems': 0.24; 'header:In-Reply-To:1': 0.24; 'script': 0.25; 'figure': 0.27; 'command': 0.28; 'options': 0.28; "doesn't": 0.28; 'looks': 0.29; '-0700,': 0.29; 'disabling': 0.29; 'promising': 0.29; 'received:se': 0.29; 'cc:no real name:2**1': 0.29; 'guess': 0.29; 'work.': 0.30; 'fri,': 0.31; 'mode': 0.31; 'url:mailman': 0.31; "i'd": 0.31; 'certain': 0.31; 'skip:s 30': 0.31; 'option': 0.31; 'url:python': 0.33; 'faq': 0.33; 'policies': 0.33; 'open': 0.33; 'file': 0.34; 'add': 0.34; 'on,': 0.35; 'url:listinfo': 0.35; 'fail': 0.35; 'instance': 0.35; 'skip:> 10': 0.35; 'something': 0.35; 'but': 0.36; 'url:org': 0.36; 'there': 0.36; 'url:2012': 0.36; 'subject:: ': 0.37; 'charset:us-ascii': 0.37; 'pdf': 0.37; 'test': 0.39; 'things': 0.39; 'area': 0.39; 'where': 0.40; 'called': 0.40; 'your': 0.60; 'skip:u 10': 0.62; 'header:Message- Id:1': 0.62; 'places': 0.64; 'due': 0.65; 'here': 0.66; 'adobe': 0.66; 'insight': 0.76; 'received:89': 0.80; 'subject:Using': 0.84; 'acrobat': 0.91; 'url:27': 0.91 To: Naftali cc: python-list@python.org, lac@openend.se From: Laura Creighton Subject: Re: Opening PDF Using subprocess.Popen Failing In-Reply-To: Message from Naftali of "Fri, 19 Jun 2015 10:24:56 -0700." <4857b9a4-386f-4ae4-861b-09a9564557c7@googlegroups.com> References: <4857b9a4-386f-4ae4-861b-09a9564557c7@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <11716.1434737833.1@fido> Content-Transfer-Encoding: quoted-printable Date: Fri, 19 Jun 2015 20:17:13 +0200 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (theraft.openend.se [89.233.217.130]); Fri, 19 Jun 2015 20:17:15 +0200 (CEST) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 69 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1434737849 news.xs4all.nl 2873 [2001:888:2000:d::a6]:51495 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:92893 In a message of Fri, 19 Jun 2015 10:24:56 -0700, Naftali writes: >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-prote= cted-mode-due-to-a-problem-with-your-system-configuration/) > >I am using subprocess.Popen("AcroRe32.exe /n ") which is the ac= tuall 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 th= at it's due to something like "JS-invoked processes: Launching a process t= hrough JavaScript is not allowed with Protected Mode enabled." = > >But my naive understanding was that when I give Popen instruction, the co= mmand 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 so= mehow '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 =3D " unlocked.pdf" > >commandstr =3D "qpdf --decrypt " + sys.argv[1] + outputname >os.system(commandstr) > >new_command_str =3D "AcroRd32.exe /n" + outputname >subprocess.Popen(new_command_str) > >sys.exit(0) > = >-- = >https://mail.python.org/mailman/listinfo/python-list I don't have a windows system to test this on, but I read https://www.adobe.com/devnet-docs/acrobatetk/tools/AppSec/protectedmode.ht= ml It looks like if you put your output file one of the places that Acrobat allows, then things might work. You can then move the thing later to where you want it to go. There is also this tantalising FAQ entry: When custom policies fail for certain workflows, what are the options other than disabling Protected Mode? One option is to add custom policies to bypass protected mode = restrictions. Now, I haven't found out _how you do that_ yet, but seems like a promising area for research. Laura