0

I am trying to write a flask application with several routes that uses python-escpos functions to print a receipt.

The route works and prints the receipt instantly but subsequent prints are either delayed by 2+ minutes or if the flask application is killed the backlog prints instantly.

I was initially using python-escpos 2.2.0 which worked flawlessly with prints occurring instantly one after another each time I accessed the route. Python-escpos 2.2.0 (stable release) however does not allow for text manipulation or printing images. I switched over to the latest pre-release 3.0a4 and this is where my problems began with the delay.

from flask import Flask, flash
from escpos import *
import PIL

app = Flask(__name__, template_folder='.')

@app.route('/')
def homepage():
  printerip = "192.168.3.197"
  Epson = printer.Network(printerip)
  Epson.text('CHARGING')
  Epson.cut()
  return 'printed'

if __name__ == '__main__':
  app.run(host='0.0.0.0', debug=True, port=80)

The expectation is that when visiting the route the receipt will print instantly even if a few seconds delay, currently experiencing print delays of 2+ minutes.

jwhit265
  • 21
  • 2
  • Since it works with the release version and not with the alpha, I recommend [filing a bug report](https://github.com/python-escpos/python-escpos/issues/new) with the python-escpos project. – Nick K9 Jun 18 '19 at 12:32

1 Answers1

0

I reported a bug over at github on the python-escpos project as recommended by Nick K9. One of the the users recommended using close() at the end of my receipt code which has worked. The bug I filed can be found here.

jwhit265
  • 21
  • 2