Web lists-archives.com

Re: Tea4CUPS: TEABILLING reports error




On Wed 30 May 2018 at 23:18:27 +0200, Rainer Dorsch wrote:

> On Mittwoch, 30. Mai 2018 16:44:42 CEST Brian Potkin wrote:
> > On Wed 30 May 2018 at 12:40:35 +0200, Rainer Dorsch wrote:
> > > I have tea4cups configured to power on my printer before printing. In
> > > order to do this, I prepended tea4cups:/ to the DeviceURI in
> > > printers.conf (if I remove this and power on the
> > > printer manually before printing, everything works as expected):
> > I suppose this should work ok if done when cupsd is not running. I'd be
> > inclined to modify the existing queue or set up a new one. A virtual
> > queue would allow testing Tea4CUPS without wrapping the backend.
> 
> I do the modification after a systemd stop cups.service

It is intended that printers.conf is managed by cupsd and not by user
editing. Into the bargain, future CUPS is planned to rename and relocate
the file. (But this is not the cuase of your problem).

> > The printer is being powered on by some type of electronic switch?
> 
> Yes, this one: http://energenie.com/item.aspx?id=7415&lang=en
> 
> Works well with the sispmctl package.

I don't have one of these. But it is easy to pretend I do. (See below).

> > > /etc/cups/printers.conf:
> > > DeviceURI tea4cups:/http://hpljwlan:631/ipp/
> > 
> > http:// is a symlink the ipp backend. It's always useful to know what
> > model of printer is being used.
> 
> I was not aware of that, I need to dig into more detail here in the next days.

Not the cause of your problem and not really an issue. I was just a bit
surprised to see http:// used instead of ipp://.

> The printer is a HP CP1525NW.

An oldish printer. I wonder how well the ipp protocol is implemented on
it? socket:// might be better.

[...]

> > tea4cups.conf is the configuration file for Tea4CUPS. I guess you are
> > using a prehook or posthook to activate the printer; we really need to
> > know what you have for it (including any associated script). What part
> > does TEABILLING play in the process?
> 
> Yes, a prehook and the TEABILLING shows in the stack trace, I am not using it 
> intentionally at all...
> 
> Aaah...now I see what went wrong: My orignal post contained the information, 
> but it seems only in the HTML view, not sure why kmail decided to leave out 
> this information in the text representation  :-/ Avoided HTML view now in this 
> mail, sorry for that.
> 
> For easier reference I append the previous post:
> 
> I have tea4cups configured to power on my printer before printing. In order to 
> do this, I prepended tea4cups:/ to the DeviceURI in printers.conf (if I remove 
> this and power on the printer manually before printing, everything works as 
> expected):
>  
> /etc/cups/printers.conf:
> DeviceURI tea4cups:/http://hpljwlan:631/ipp/
> I configured the printer power on script:
>  
> /etc/cups/tea4cups.conf:
> prehook_sispmctl : /usr/local/bin/printeron

What are the script contents?
  
> but I get unfortunately an error in /var/log/cups/error_log
> with every print job and the job is stopped.
>  
> E [30/May/2018:08:51:40 +0200] [Job 16] Tea4CUPS (PID 9689) : Traceback (most 
> recent call last): 
> E [30/May/2018:08:51:40 +0200] [Job 16] Tea4CUPS (PID 9689) :   File \"/usr/
> lib/cups/backend/tea4cups\", line 1502, in <module> 
> E [30/May/2018:08:51:40 +0200] [Job 16] Tea4CUPS (PID 9689) :     
> wrapper.exportAttributes() 
> E [30/May/2018:08:51:40 +0200] [Job 16] Tea4CUPS (PID 9689) :   File \"/usr/
> lib/cups/backend/tea4cups\", line 1214, in exportAttributes 
> E [30/May/2018:08:51:40 +0200] [Job 16] Tea4CUPS (PID 9689) :     
> os.environ[\"TEABILLING\"] = self.JobBilling or \"\" 
> E [30/May/2018:08:51:40 +0200] [Job 16] Tea4CUPS (PID 9689) :   File \"/usr/
> lib/python2.7/os.py\", line 473, in __setitem__ 
> E [30/May/2018:08:51:40 +0200] [Job 16] Tea4CUPS (PID 9689) :     putenv(key, 
> item) 
> E [30/May/2018:08:51:40 +0200] [Job 16] Tea4CUPS (PID 9689) : TypeError: 
> putenv() argument 2 must be string, not int
> 
> Is seems something goes wrong while setting the TEABILLING environment 
> variable.

Your tea4cups.conf is poorly. Here is a minimal one which works for me:

  [Global]
  debug : yes
  directory : /var/spool/cups/
  prehook_sispmctl : sispmctl -ng 4 2> /tmp/SISPMCTL

1. touch /tmp/SISPMCTL

2. Set up a raw queue:

    lpadmin -p virtq -v tea4cups:// -E -m raw

3. Print to virtq:

    lp -d virtq /etc/services

4. cat /tmp/SISPMCTL and look at the error_log.

5. Test with your original queue and my tea4cups.conf.

-- 
Brian.