15

I have a Python 3 script that is going to be doing some regex substitution on some Rich Text Files (rtf) and I would like to be able to print out a whole directory's files on Windows, Linux, and Mac.

Is there a way to print to the OS's default printer so that it works in all platforms?

nbro
  • 15,395
  • 32
  • 113
  • 196
Magwich
  • 555
  • 4
  • 10
  • 19
  • PyQt is cross-platform, and might be able to print, although I've never used it myself, so don't know if you could do it without setting up a GUI. – Craig McQueen Feb 23 '10 at 07:58
  • PyQt looks good, but I am wanting something that iss free to use for commercial development. PyQt is not. – Magwich Feb 25 '10 at 01:33

2 Answers2

7

There is no cross-platform way. On Linux and OS X you can invoke lpr(1) via subprocess and CUPS will handle the document conversion as best as possible, but Windows is trickier.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
-1

With the OS module you can print files in Windows or higher.