{"id":934,"date":"2022-08-30T15:09:37","date_gmt":"2022-08-30T15:09:37","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/error-during-importing-module-in-openerp-for-windos-xp-version-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:09:37","modified_gmt":"2022-08-30T15:09:37","slug":"error-during-importing-module-in-openerp-for-windos-xp-version-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/error-during-importing-module-in-openerp-for-windos-xp-version-collection-of-common-programming-errors\/","title":{"rendered":"error during importing module in openerp for windos xp version?-Collection of common programming errors"},"content":{"rendered":"<p>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.<\/p>\n<pre><code>import win32print\nprinter=OpenPrinter(win32print.GetDefaultPrinter())\nhJob = win32print.StartDocPrinter (printer, 1, (\"RVGI Print\", None, \"RAW\"))\ng=open('test3.txt','r')\nraw_data = bytes ( open( 'test3.txt' , 'r').read ())\ntry:\n    win32print.StartPagePrinter (printer)\n    win32print.WritePrinter (printer, raw_data)\n    win32print.EndPagePrinter (printer)\nfinally:\n    win32print.EndDocPrinter (printer)\n    win32print.ClosePrinter (printer)\n<\/code><\/pre>\n<ol>\n<li>\n<p>After looking at your code, I can find only problem that is <code>undefined variable OpenPrinter<\/code> which can be rectified by merely replacing OpenPrinter() with <code>win32print.OpenPrinter()<\/code><\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-09 23:00:37. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>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, (&#8220;RVGI Print&#8221;, None, &#8220;RAW&#8221;)) g=open(&#8216;test3.txt&#8217;,&#8217;r&#8217;) raw_data = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-934","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/934","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=934"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/934\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=934"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=934"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=934"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}