[Tutor] os.system refuses to print from a script

dman dsh8290@rit.edu
Fri, 21 Sep 2001 08:21:55 -0400


On Thu, Sep 20, 2001 at 03:00:31PM +0400, Cerulean Rodent wrote:
| Some data is written to file as the script goes about its business.
| 
| Printing the file from command line with
| 
| lpr filename
| 
| works just fine. Invoke the interpreter from the command line, get a
| familiar prompt. Enter the following
| 
| import os
| os.system('lpr filename') 
| 
| the file gets printed without a glitch. 
| 
| do the same from the script, and I get
| 
| lpr: unable to print file: client-error-bad-request
| 
| change os.system('lpr filename') for os.system('pwd') to check whether I'm
| in the correct directory... I am. But lpr still returns an error when
| invoked from a script (and so does lp, for that matter). 

Hmm,  I'm not really certain on this, but I think that lpr may not be
setup quite right.  I use CUPS on my system, and I have found that
_sometimes_ I can use lp or lpr without specifying a destination and
other times it complains about it.  I haven't yet figured out how to
make it consistently default correctly (the config looks correct).  I
recommend researching lpr a bit to see what sort of conditions can
trigger that particular error message and then try and work back to
see how that condition was created in the script.

| PS By the by, just how does one dump the results of one's meek attempts at
| programming to Useless Python? Is it still available? All the links Google
| returns for "useless python" are as dead as Spandau Ballet. 

Send a mail to Rob Andrews.  He takes care of that.

HTH,
-D