Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Stephen Hansen Newsgroups: comp.lang.python Subject: Re: Running lpr on windows from python Date: Wed, 20 Apr 2016 14:01:59 -0700 Lines: 17 Message-ID: References: <7ec37d41-61eb-4c93-ae21-28d108c261f1@googlegroups.com> <1461186119.52599.584860929.759DC943@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de lGPLs/uYK0bTRIem9JoO3gd8ynuca7ZF7oFxBBIh1OZQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'line:': 0.07; 'received:internal': 0.09; 'subject:python': 0.14; 'wed,': 0.15; 'commandline': 0.16; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'slashes.': 0.16; 'subject:windows': 0.16; 'wrote:': 0.16; 'string': 0.17; 'stephen': 0.22; 'am,': 0.23; 'header:In-Reply- To:1': 0.24; 'command': 0.26; 'raw': 0.27; '---': 0.28; 'to:addr :python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'front': 0.38; 'received:66': 0.38; 'subject:from': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'header:Message-Id:1': 0.61; 'making': 0.62; '20,': 0.66 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=ixokai.io; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=lSW0tkYt0F/0OhqDKWX2POPkcyw=; b=qGlMPG 5z3jJ1g24kI0I3or5JTqpGlxYFCEOZB1Zzrs2/SsAHJzAVFnXByCQQckqvKTZenH wdeuVjMFoNz1SO0Z0t28SNdBJfzDNd8jOpjTXdt7jdTSZ0Rs4HxEJCg8ZkIFiF74 3lIlowESFVWGWIDNChSbzu4nd3TuXFHbhT9dg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=lSW0tkYt0F/0Ohq DKWX2POPkcyw=; b=XWzqVVVDhjLnI71z1WHb2QkQGWl3WZQwkQLXvOygB+4L5En 8RSRLe4gsq3ox4OISi9TuGL5ztdkaJJtTiYGXpEoJ6fGe7RBGmSkKv2gSeWZ/rE8 p2skEPZD2ZT3nZVtyzkszqi7BZRC6OxKW7S13jgDJsFKxezAU6+8bJgxt/RQ= X-Sasl-Enc: L9Ph+QnfP1WeXGGdH5yyY7ErZvcyfz6iJc4AgKYHKikk 1461186119 X-Mailer: MessagingEngine.com Webmail Interface - ajax-71fd8077 In-Reply-To: <7ec37d41-61eb-4c93-ae21-28d108c261f1@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <1461186119.52599.584860929.759DC943@webmail.messagingengine.com> X-Mailman-Original-References: <7ec37d41-61eb-4c93-ae21-28d108c261f1@googlegroups.com> Xref: csiph.com comp.lang.python:107425 On Wed, Apr 20, 2016, at 06:57 AM, loial wrote: > process = subprocess.Popen(commandline, shell=True, > stdout=subprocess.PIPE, stderr=subprocess.PIPE) > > where command line is > C:/windows/system32/lpr.exe -S 172.28.84.38 -P RAW C:/john/myfile Try making command line: commandline = r"C:\windows\system32\lpr.exe -S 172.28.84.38 -P RAW C:\john\myfile" The r in front of the string makes it a raw string so you don't have to double up the slashes. --- Stephen Hansen m e @ i x o k a i . i o