[Tutor] trouble understanding the difference

johnf jfabiani at yolo.com
Fri Apr 10 17:35:13 CEST 2009

I can get the following to work:
os.system('lp -d printer invoice.pdf')

but what I think is the correct way for the future is:
subprocess.Popen('lp -d printer invoice.pdf')
and it does not work???  

Can someone explain what I'm doing wrong?

Traceback (most recent call last):
  File "/home/johnf/downloads/dabo/dabo/ui/uiwx/dControlMixin.py", line 27, in 
    self.raiseEvent(dEvents.Hit, evt, *args, **kwargs)
  File "/home/johnf/downloads/dabo/dabo/ui/uiwx/dPemMixin.py", line 949, in 
    super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args, 
  File "/home/johnf/downloads/dabo/dabo/lib/eventMixin.py", line 93, in 
  File "RptForm1.py", line 222, in doReport
    sendtoprint = subprocess.Popen('lp -d printer invoice.pdf')
  File "/usr/lib/python2.5/subprocess.py", line 593, in __init__
    errread, errwrite)
  File "/usr/lib/python2.5/subprocess.py", line 1135, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

John Fabiani

More information about the Tutor mailing list