Path: csiph.com!feeder.erje.net!2.us.feeder.erje.net!news.roellig-ltd.de!open-news-network.org!border2.nntp.ams1.giganews.com!nntp.giganews.com!newsreader4.netcologne.de!news.netcologne.de!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail From: Random832 Newsgroups: comp.lang.python Subject: Re: Running lpr on windows from python Date: Wed, 20 Apr 2016 10:09:10 -0400 Lines: 31 Message-ID: References: <7ec37d41-61eb-4c93-ae21-28d108c261f1@googlegroups.com> <1461161350.2918798.584433545.40877410@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de O6tNn4kHCOTj5hRztefF0QPieVr3IVtHRVMAlB5quiXQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '2147483647': 0.09; 'received:internal': 0.09; 'python': 0.10; 'subject:python': 0.14; 'wed,': 0.15; 'file,': 0.15; 'command,': 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; 'subject:windows': 0.16; 'subprocess': 0.16; 'wrote:': 0.16; 'typing': 0.18; 'python?': 0.18; 'windows': 0.20; '64-bit': 0.22; 'file.': 0.22; 'trying': 0.22; 'bit': 0.23; 'recognized': 0.24; 'header:In-Reply-To:1': 0.24; "doesn't": 0.26; 'command': 0.26; 'external': 0.27; 'error': 0.27; 'raw': 0.27; '32-bit': 0.29; 'follows': 0.29; 'windows,': 0.29; 'print': 0.30; 'though,': 0.32; 'run': 0.33; 'machine.': 0.33; 'though.': 0.33; 'windows.': 0.33; "skip:' 20": 0.34; 'text': 0.35; 'exist': 0.35; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'skip:9 10': 0.37; 'received:66': 0.38; 'whatever': 0.39; 'subject:from': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'address': 0.61; 'header:Message-Id:1': 0.61; 'panel': 0.63; '20,': 0.66; 'prompt': 0.79; 'does?': 0.84; 'url:php': 0.86 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.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=mesmtp; bh=5x4sWqokRAjCevsaP2Gxz0vYeJE=; b=eHMTKB f2EkrTh0DMJvQE/QbfMbHmcwgW1CkRiZ5kJro035Vv3a+vJ5P8PE2LG7kX2ZV54Y Hccf1XzrfwQIkpVigWS73z4I52TrAXu9P4MYbpVLSDQ9trL7weSl7Uq5Adv4PLfu Pr8IoeuRAIHJdxteKujya8G9YUmM5rn00DmNs= 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=5x4sWqokRAjCevs aP2Gxz0vYeJE=; b=bP69aX6IeN9LHk8ITnRUf/tYYaP8qdVg5eUyCSw/qdszs2c NVASWf7VHqpbQ9mCdjoB2b6oVTtqVviizpzWdh+aQZo5DNsSUiOL1pW1x/pGnX1n OscKlWXFl5GPyMSsn8jyvyXBnq7u2cYyvrhHj3uWIk4eGL4Aw4wX0MF/c9SY= X-Sasl-Enc: pSOCD+rgp/PamZqibR53Izlnx+yMkJ5+QttcsqCNXovC 1461161350 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: <1461161350.2918798.584433545.40877410@webmail.messagingengine.com> X-Mailman-Original-References: <7ec37d41-61eb-4c93-ae21-28d108c261f1@googlegroups.com> Xref: csiph.com comp.lang.python:107413 On Wed, Apr 20, 2016, at 09:57, loial wrote: > I am trying to run lpr from python 2.7.10 on windows > > However I always get the error > 'C:/windows/system32/lpr.exe ' is not recognized as an internal or > external command, > operable program or batch file. > > Even though typing the same at the command prompt works OK It does? This command doesn't exist on my machine. It's not a standard part of windows. Just to check though, are you 64-bit windows, and 32 or 64 bit python? (To find out what kind of windows, go to the system control panel - to find out if python is 64-bit look at the value of sys.maxsize, it's 2147483647 on 32-bit systems and 9223372036854775807 on 64-bit) > Any ideas? > > I am using subprocess as follows > > 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 If all you want to do is print a text file, see http://www.robvanderwoude.com/printfiles.php - these commands may not let you do whatever you're trying to do with that IP address though.