Python Forum
Control a dot matrix printer
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Control a dot matrix printer
#3
I'm a bit confused,
I want for example to send 27 120 0 to set it in Utility mode.
When I do :
printer = open("LPT1", "w")
printer.write("\x27\x120\x0")
printer.close
It says I can't use more that two numbers:
Error:
File "C:\Documents and Settings\Administrateur\Bureau\test.py", line 2 printer.write("\x27\x120\x0") ^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 9-11: truncated \xXX escape
And when I do :
printer = open("LPT1", "w")
printer.write(chr(27), chr(120), chr(0))
printer.close
It obviously tells me that printer.write takes only one argument and that I gave 3 of them.
Reply


Messages In This Thread
Control a dot matrix printer - by Clement_2000 - Jan-26-2019, 12:21 PM
RE: Control a dot matrix printer - by Larz60+ - Jan-26-2019, 11:59 PM
RE: Control a dot matrix printer - by Clement_2000 - Jan-27-2019, 10:50 AM
RE: Control a dot matrix printer - by Larz60+ - Jan-27-2019, 03:15 PM
RE: Control a dot matrix printer - by Clement_2000 - Jan-27-2019, 09:00 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Check if two matrix are equal and of not add the matrix to the list quest 3 938 Jul-10-2023, 02:41 AM
Last Post: deanhystad
  Trying to send file to printer with no results. chob_thomas 2 3,533 Dec-21-2022, 07:12 AM
Last Post: Pedroski55
  How do you marshal the default printer setup to print? hammer 0 1,326 May-29-2022, 02:54 PM
Last Post: hammer
  Can you print a string variable to printer hammer 2 2,062 Apr-30-2022, 11:48 PM
Last Post: hammer
  How to multiply a matrix with herself, until the zero matrix results peanutbutterandjelly 3 3,476 May-03-2021, 06:30 AM
Last Post: Gribouillis
  Printing to a printer connected to pi 4 alan 2 2,561 Oct-04-2020, 10:08 PM
Last Post: alan
  python-printer-escpos 0.0.3 ERROR neethuvp 1 3,783 Nov-12-2019, 12:20 PM
Last Post: Larz60+
  Is this possible in Python? Auto-Send-to-printer on script run? pcsailor 8 17,134 Jul-19-2019, 09:33 AM
Last Post: perfringo
  print a persian file by thermal printer and python-escpos mnodule gray 12 12,904 Nov-03-2017, 11:15 PM
Last Post: Larz60+
  printing a text file by python and thermal printer gray 6 20,949 Jul-30-2017, 05:56 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020