Printing from python on Windows platform

Johann Spies jhspies at
Thu Aug 5 08:41:35 EDT 1999

On Wed, 4 Aug 1999 david.stegbauer at wrote:

> Printing under windows is not such easy. I personally write to a file,
> then I pass it to MS Word to print. I format the output using RTF, but I
> think there is no problem to use HTML and Netscape - then it is
> sufficient to spawn it like
> from os import spawnv, P_NOWAIT spawnv(P_NOWAIT,
> '/print("filename.html")')) 

That is quite complicated.  I do not have MS Word and do not know the file
structure of RTF or HTML at the moment.  I suppose to go this route it
will be easier for me to use LateX for formatted output.  After some
suggestions sent to me I am using l = open('LPT1',w) and l.write and it
works for just straight forward printing.

Thanks for your input.  As somebody who do not know windows, this is quite
new to me and I will experiment with your code to try and understand what
is happening.

| Johann Spies                                 Windsorlaan 19              |
| jhspies at                3201 Pietermaritzburg             |
| Tel/Faks Nr. +27 331-46-1310		       Suid-Afrika (South Africa)  |

     "I am crucified with Christ, nevertheless I live; yet 
      not I, but Christ liveth in me; and the life which I 
      now live in the flesh I live by the faith of the Son 
      of God, who loved me, and gave himself for me."       
                               Galatians 2:20 

More information about the Python-list mailing list