[Tutor] Program won't print out in Windows 10

Steven D'Aprano steve at pearwood.info
Sun Jul 24 12:28:18 EDT 2016


On Sun, Jul 24, 2016 at 11:38:06AM -0400, Ken G. wrote:
> While the following program prints out fine using
> Python 2.7.6 in Ubuntu 14.04.4 as developed using
> Geany 1.23.1, same program won't print out to printer
> under Windows 10 Pro (64 bit). Geany uses there is
> version 1.28 using Python 2.7.12. I can use CTRL-P
> to print out the listing.

The critical piece of code that does the printing is the external 
function "lpr". This is not part of Python: it is a Unix/Linux command 
that controls the "line printer". On some machines lpr doesn't exist and 
it may be called "lp" instead.

Does lpr or lp exist on Windows 10? I can see it exists in Windows 7.

If you open up a Windows shell, the command.com or cmd.exe or whatever 
it is called, and enter "lpr", what happens?

Perhaps you are getting a permissions error. Perhaps lpr simply isn't 
installed, or isn't configured properly, or can't find your printer.

Once you get lpr working from the Windows 10 command line, then and only 
then can you hope to get it working from Python.


-- 
Steve


More information about the Tutor mailing list