writing a filter in python
Chris Liechti
cliechti at gmx.net
Thu Jun 6 18:19:43 EDT 2002
David Bear <david.bear at asu.edu> wrote in news:adm43t$p5j$1 at news.asu.edu:
> I'm writing a filter to be used by lprng. Since there is no stdout I
> am wondering two things:
>
> 1) good strategies for showing error message (was thinking of syslog)
i created my own /var/log/myfilter and redirected sys.stdout adn std err to
that file. that way you don't miss any important exception, which makes
debuging easier.
> 2) an easy way to catch all exceptions and quickly return back to the
> caller (lpd)
try:
... your code here
except:
traceback.print_exc(file=yourlogfile_or_sysstderr)
why do you need to be quick? i thing lpr only tries to restart your job if
it doesn't run properly. but when it runs it may take a long time.
(atleast it wrork for my pdf printer, which i controlol through a python
script and lprng)
chris
> I'm noticing that if my script doesnt run fast enough I may end up
> have lpd try multiple times to run it.
>
> Any advice?
--
Chris <cliechti at gmx.net>
More information about the Python-list
mailing list