[Tutor] Something new in line printing?

Ken Green beachkidken at gmail.com
Mon Nov 11 17:51:01 EST 2019


I have not use Python printing for quite a while.
In the meantime, I acquired a new printer, a HP
OfficeJet 4652. Ran a program to print the output
of a program and get the following error:


lpr: Error - No default destination.

------------------
(program exited with code: 0)
Press return to continue

End of error message.

I created a short program to print a simple line as
follow:

# sample_printing.py
# 11/11/2019

import sys, os, time

print
datecode = "02042011"
month = datecode[0:2]
date  = datecode[2:4]
year  = datecode[4:8]
datecode = year + month + date
pr = (os.popen("lpr", "w"))
pr.write (datecode)
pr.close()

End of code.

Thanks for pointing me into the right direction.
Did something changed?

Thanks guys and gals.

Ken


More information about the Tutor mailing list