error during importing module in openerp for windos xp version?-Collection of common programming errors

I am using this code in openerp7 for directoly print from printer this code I was written in main.py, but when I start server it gives unhandled error on my browser console actually this error happen with importing win32print module.

import win32print
printer=OpenPrinter(win32print.GetDefaultPrinter())
hJob = win32print.StartDocPrinter (printer, 1, ("RVGI Print", None, "RAW"))
g=open('test3.txt','r')
raw_data = bytes ( open( 'test3.txt' , 'r').read ())
try:
    win32print.StartPagePrinter (printer)
    win32print.WritePrinter (printer, raw_data)
    win32print.EndPagePrinter (printer)
finally:
    win32print.EndDocPrinter (printer)
    win32print.ClosePrinter (printer)
  1. After looking at your code, I can find only problem that is undefined variable OpenPrinter which can be rectified by merely replacing OpenPrinter() with win32print.OpenPrinter()

Originally posted 2013-11-09 23:00:37.