1

The question may seem obvious, however, I didn't find the answer. I'm just trying to send an html local page (not the source) from Python to the printer.

The code:

NomFichier = 'test.html'
Fichier = open(NomFichier,'w')      
Fichier.write(doc.getvalue())
time.sleep(1)

printer = os.popen('lpr','w')
printer.write(Fichier)
printer.close()
Fichier.close()

The error message I get:

TypeError: expected a character buffer object lpr : No file in the printer request.

Any idea what am I doing wrong? Thanks

5
  • 1
    You want to print "not the source", i.e. you want to render it? Commented Jun 5, 2015 at 8:25
  • 1
    Yes, render the html source as sort to print it as a webpage Commented Jun 5, 2015 at 8:57
  • That will be quite a lot of work. Have a look at this for rendering in the first place, but no idea how to print that... Commented Jun 5, 2015 at 10:07
  • I guess I'll have to manage this with the shell script then... Commented Jun 5, 2015 at 10:20
  • That won't get you around the problem of having to render HTML to print it. Commented Jun 5, 2015 at 10:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.