Habe folgenden Code
Code: Alles auswählen
pdf = canvas.Canvas(r'/opt/bash/protokoll.pdf')
pdf.setPageSize((89*mm,40*mm))
pdf.setFont("Courier-Bold", 8)
pdf.drawString(10*mm,35*mm,"Auftrag:")
pdf.drawString(10*mm,30*mm,"Material:")
pdf.drawString(10*mm,25*mm,"Groesse:")
pdf.drawString(10*mm,20*mm,"Gewicht:")
pdf.drawString(10*mm,15*mm,"Kundenartikel:")
pdf.setFont("Courier", 4)
pdf.drawString(10*mm,3*mm,time.strftime("%d.%m.%Y %H:%M:%S"))
pdf.showPage()
pdf.save()
subprocess.call('lpr -P DYMO_LabelWriter_450', 64, '/opt/bash/protokoll.pdf')
dieser führt dann zu einem Traceback
Code: Alles auswählen
Traceback (most recent call last):
File "auftraege.py", line 79, in DruckTest
subprocess.check_call('lpr -P DYMO_LabelWriter_450',128, '/opt/bash/protokoll.pdf')
File "/usr/lib/python3.4/subprocess.py", line 556, in check_call
retcode = call(*popenargs, **kwargs)
File "/usr/lib/python3.4/subprocess.py", line 537, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/lib/python3.4/subprocess.py", line 859, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.4/subprocess.py", line 1457, in _execute_child
raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Keine Berechtigung
pi@raspberrypi:~ $
lpr -P DYMO_LabelWriter_450' /opt/bash/protokoll.pdf
wird es Korrekt Ausgedruckt
wenn ich bei subprocess die 64 Weglasse
dann kommt der Fehler "bufsize must be an integer"
Wie muss ich den subprocess richtig ausführen?
mfg Peter