Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Tim Golden Newsgroups: comp.lang.python Subject: Re: Running lpr on windows from python Date: Wed, 20 Apr 2016 15:08:49 +0100 Lines: 36 Message-ID: References: <7ec37d41-61eb-4c93-ae21-28d108c261f1@googlegroups.com> <57178D71.5050408@timgolden.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de loBHfN4ZV+bWesxHlLLpSgxzHTs2WgYhgAT9x4gapk7w== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'url:pipermail': 0.05; 'type:': 0.09; 'example:': 0.10; 'python': 0.10; 'assume': 0.11; 'subject:python': 0.14; 'also:': 0.16; 'command,': 0.16; 'from:addr:timgolden.me.uk': 0.16; 'from:name:tim golden': 0.16; 'message-id:@timgolden.me.uk': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'subject:windows': 0.16; 'subprocess': 0.16; 'tjg': 0.16; 'wrote:': 0.16; 'typing': 0.18; 'windows': 0.20; '64-bit': 0.22; 'file.': 0.22; 'trying': 0.22; 'recognized': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'command': 0.26; 'external': 0.27; 'error': 0.27; 'raw': 0.27; 'follows': 0.29; 'path,': 0.29; 'system?': 0.29; 'probably': 0.31; 'run': 0.33; 'url:python': 0.33; 'windows.': 0.33; "skip:' 20": 0.34; 'so,': 0.35; 'dir': 0.35; "isn't": 0.35; 'but': 0.36; 'url:org': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'subject:from': 0.39; 'received:192': 0.39; 'rather': 0.39; 'url:mail': 0.40; 'to:addr:python.org': 0.40; 'where': 0.40; 'called': 0.40; 'charset:windows-1252': 0.62; 'is.': 0.63; 'from:addr:mail': 0.70; 'prompt': 0.79; 'location?': 0.84 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 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: <57178D71.5050408@timgolden.me.uk> X-Mailman-Original-References: <7ec37d41-61eb-4c93-ae21-28d108c261f1@googlegroups.com> Xref: csiph.com comp.lang.python:107412 On 20/04/2016 14: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 > > > 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 > Ummm.. Do you actually have a program called lpr.exe in that location? It's not usual on Windows. (I rather assume you do since you give the full path, but still...) IOW, what happens if you type: dir C:\windows\system32\lpr.exe at a command promopt? Also: are you on a 64-bit system? If so, c:\windows\system32 probably isn't where you think it is. cf, for example: https://mail.python.org/pipermail/python-win32/2012-March/012121.html TJG