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


Groups > comp.lang.python > #107500

Re: Running lpr on windows from python

From eryk sun <eryksun@gmail.com>
Newsgroups comp.lang.python
Subject Re: Running lpr on windows from python
Date 2016-04-22 12:04 -0500
Message-ID <mailman.19.1461344712.2861.python-list@python.org> (permalink)
References <7ec37d41-61eb-4c93-ae21-28d108c261f1@googlegroups.com> <982a6a8e-f987-4e9b-ae2e-90f3d9aad4c9@googlegroups.com> <fb733951-4abd-44b7-b13c-a24d92009077@googlegroups.com> <CACL+1au_Jh5J6ns8Avt+4hpoWL+jj0mBJdPf1mWZDoG9qhv2cQ@mail.gmail.com>

Show all headers | View raw


On Fri, Apr 22, 2016 at 10:07 AM, loial <jldunn2000@gmail.com> wrote:
> I finally found the solution here :
>
> http://www.tomshardware.co.uk/forum/240019-44-error-windows
>
> Copied lpr.exe, lprhelp.dll, and lprmonui.dll from the System32 folder to the sysWOW64 folder

Using the virtual "SysNative" directory should work on Windows 7+
(Server 2008 R2). All you need is for CreateProcess to find the
executable. Finding the DLLs is done during process initialization, so
there's no need to copy them from the native System32 directory.

It works for me in 32-bit Python running in Windows 10:

    >>> if '32bit' in platform.architecture():
    ...     lpr = os.path.join(os.environ['SystemRoot'], 'SysNative', 'lpr.exe')
    ... else:
    ...     lpr = os.path.join(os.environ['SystemRoot'], 'System32', 'lpr.exe')
    ...
    >>> print(lpr)
    C:\Windows\SysNative\lpr.exe
    >>> subprocess.call(lpr)

    Sends a print job to a network printer

    Usage: lpr -S server -P printer [-C class] [-J job] [-o option]
[-x] [-d] filename

    Options:
          -S server    Name or ipaddress of the host providing lpd service
          -P printer   Name of the print queue
          -C class     Job classification for use on the burst page
          -J job       Job name to print on the burst page
          -o option    Indicates type of the file (by default assumes
a text file)
                       Use &quot;-o l&quot; for binary (e.g. postscript) files
          -x           Compatibility with SunOS 4.1.x and prior
          -d           Send data file first1

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


Thread

Running lpr on windows from python loial <jldunn2000@gmail.com> - 2016-04-20 06:57 -0700
  Re: Running lpr on windows from python Chris Angelico <rosuav@gmail.com> - 2016-04-21 00:07 +1000
    Re: Running lpr on windows from python loial <jldunn2000@gmail.com> - 2016-04-20 07:25 -0700
  Re: Running lpr on windows from python Tim Golden <mail@timgolden.me.uk> - 2016-04-20 15:08 +0100
  Re: Running lpr on windows from python Random832 <random832@fastmail.com> - 2016-04-20 10:09 -0400
  Re: Running lpr on windows from python loial <jldunn2000@gmail.com> - 2016-04-20 07:21 -0700
    Re: Running lpr on windows from python Tim Golden <mail@timgolden.me.uk> - 2016-04-20 15:58 +0100
    Re: Running lpr on windows from python eryk sun <eryksun@gmail.com> - 2016-04-20 22:10 -0500
  Re: Running lpr on windows from python Stephen Hansen <me+python@ixokai.io> - 2016-04-20 14:01 -0700
  Re: Running lpr on windows from python loial <jldunn2000@gmail.com> - 2016-04-22 04:30 -0700
    Re: Running lpr on windows from python loial <jldunn2000@gmail.com> - 2016-04-22 08:07 -0700
      Re: Running lpr on windows from python eryk sun <eryksun@gmail.com> - 2016-04-22 12:04 -0500

csiph-web