Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 540170 - net-print/hplip-3.14.10 - cannot read ink cartridge levels on an HP photosmart C4190
Summary: net-print/hplip-3.14.10 - cannot read ink cartridge levels on an HP photosmar...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Daniel Pielmeier
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-15 18:15 UTC by Fab
Modified: 2017-02-18 19:22 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
find . -name '*.py' -type f -print | xargs head -n 1 (shebangs.txt,7.99 KB, text/plain)
2015-04-04 13:13 UTC, Fab
Details
hp-check output (hp-check.txt,9.84 KB, text/plain)
2015-04-04 14:18 UTC, Fab
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fab 2015-02-15 18:15:11 UTC
I have a HP photosmart C4190. Everything works fine except that hplip is unable to read ink cartridge levels. I remember old versions that were able to.

Upstream bug : https://bugs.launchpad.net/hplip/+bug/1354731
Exactly same behavior and error output.

Reproducible: Always
Comment 1 Daniel Pielmeier gentoo-dev 2015-02-22 14:48:52 UTC
I can not confirm this behavior with a HP Photosmart 6510. Lets wait for upstream comments on this issue.
Comment 2 Daniel Pielmeier gentoo-dev 2015-04-04 10:32:10 UTC
I found the error! I bet you are using python3 as default python interpreter. Try switching back to python2 and try again.
Comment 3 Daniel Pielmeier gentoo-dev 2015-04-04 10:59:57 UTC
See the upstream bug if want to know the details of this issue.
Comment 4 Fab 2015-04-04 11:55:53 UTC
Yes, I'm using python3 as default python interpreter, but after switching back to python2.7, the error is still the same, even after reloading my desktop session.
Are you able to reproduce with python3 but not with python2 ? Thanks.
Comment 5 Daniel Pielmeier gentoo-dev 2015-04-04 12:47:18 UTC
(In reply to Fab from comment #4)
> Yes, I'm using python3 as default python interpreter, but after switching
> back to python2.7, the error is still the same, even after reloading my
> desktop session.
> Are you able to reproduce with python3 but not with python2 ? Thanks.

Here it works regardless of the default interpreter. After thinking about it this is the way it should be. hplip currently only works with python2, so the setup forces python2 regardless of the default interpreter.

From the error message you get it looks like the issue is caused by the python2 vs python3 issue I mentioned on the upstream bug however.

Can you check if the python files in /usr/share/hplip/ have the correct shebangs? They should read:
#!/usr/bin/env python2.7
or
#!/usr/bin/python2.7
Comment 6 Fab 2015-04-04 13:13:45 UTC
Created attachment 400546 [details]
find . -name '*.py' -type f -print | xargs head -n 1

Seems ok. Only *.py files in subdirs doesn't have any shebang, but I guess it's normal.
Comment 7 Daniel Pielmeier gentoo-dev 2015-04-04 13:31:03 UTC
(In reply to Fab from comment #6)
> Created attachment 400546 [details]
> find . -name '*.py' -type f -print | xargs head -n 1
> 
> Seems ok. Only *.py files in subdirs doesn't have any shebang, but I guess
> it's normal.

Looks okay!

Please check if the range function is the culprit. Change line 198 from /usr/share/hplip/base/status.py to

for p in len(range(num_pens)):

and check if this fixes the issue.

If this does not fix the issue I am out of options. If it does I still wonder why it works here.

From the upstream bug someone mentioned having the problem with Ubuntu 14.04 but with 14.10 anymore. Probably some dependency versions changed which solved the issue. Can you attach the output of hp-check to identify your the dependency versions.
Comment 8 Fab 2015-04-04 14:18:47 UTC
Created attachment 400552 [details]
hp-check output

(In reply to Daniel Pielmeier from comment #7)
> Please check if the range function is the culprit. Change line 198 from
> /usr/share/hplip/base/status.py to
> 
> for p in len(range(num_pens)):
> 
> and check if this fixes the issue.
> 

When doing this modification in hplip-3.14.10, an exception is catched, the output of hp-levels -g is changing from :

> hp-levels[7759]: debug: num_pens = 2
> hp-levels[7759]: debug: pen 0 {'index': 0, 'kind': 3L, 'level': 194, 'ack': True,
> 'hp-ink': False, 'dvc': 36480L, 'level-trigger': 0, 'virgin': True, 'health': 0,
> 'known': False, 'type': 0, 'id': 0}
> hp-levels[7759]: debug: pen 1 {'index': 1, 'kind': 0L, 'level': 66, 'ack': True,
> 'hp-ink': False, 'dvc': 5580L, 'level-trigger': 0, 'virgin': True, 'health': 0,
> 'known': False, 'type': 0, 'id': 17}
> error: Error attempting to read r-value (2).

To :

> hp-levels[7730]: debug: num_pens = 2
> warning: Status parsing error: 'int' object is not iterable
> error: Error attempting to read r-value (2).

I can also try hplip-3.15.2 to see if it makes any difference.
Comment 9 Daniel Pielmeier gentoo-dev 2015-04-04 14:31:19 UTC
(In reply to Fab from comment #8)
> 
> When doing this modification in hplip-3.14.10, an exception is catched, the
> output of hp-levels -g is changing from :
> 
> > hp-levels[7759]: debug: num_pens = 2
> > hp-levels[7759]: debug: pen 0 {'index': 0, 'kind': 3L, 'level': 194, 'ack': True,
> > 'hp-ink': False, 'dvc': 36480L, 'level-trigger': 0, 'virgin': True, 'health': 0,
> > 'known': False, 'type': 0, 'id': 0}
> > hp-levels[7759]: debug: pen 1 {'index': 1, 'kind': 0L, 'level': 66, 'ack': True,
> > 'hp-ink': False, 'dvc': 5580L, 'level-trigger': 0, 'virgin': True, 'health': 0,
> > 'known': False, 'type': 0, 'id': 17}
> > error: Error attempting to read r-value (2).
> 
> To :
> 
> > hp-levels[7730]: debug: num_pens = 2
> > warning: Status parsing error: 'int' object is not iterable
> > error: Error attempting to read r-value (2).
> 

Sorry, my fault. The change should look like this (using list instead of length, this should result in he same behavior for python2 and python3 ):

for p in list(range(num_pens)):
Comment 10 Daniel Pielmeier gentoo-dev 2015-04-04 15:07:14 UTC
(In reply to Fab from comment #8)
> Created attachment 400552 [details]
> hp-check output
> 

Does not look different from mine, except that I do not have avahi installed and I am already on gcc 4.8.4.

> I can also try hplip-3.15.2 to see if it makes any difference.

You can try this. I have checked with hplip-3.14.10 and hplip-3.15.2. Both work fine here.
Comment 11 Fab 2015-04-04 15:47:42 UTC
(In reply to Daniel Pielmeier from comment #9)
> for p in list(range(num_pens)):

With this, the error is the same on version 3.14.10 :
> hp-levels[8834]: debug: num_pens = 2
> hp-levels[8834]: debug: pen 0 {'index': 0, 'kind': 3L, 'level': 194, 'ack': True,
> 'hp-ink': False, 'dvc': 36480L, 'level-trigger': 0, 'virgin': True, 'health': 0,
> 'known': False, 'type': 0, 'id': 0}
> hp-levels[8834]: debug: pen 1 {'index': 1, 'kind': 0L, 'level': 66, 'ack': True,
> 'hp-ink': False, 'dvc': 5580L, 'level-trigger': 0, 'virgin': True, 'health': 0,
> 'known': False, 'type': 0, 'id': 17}
> error: Error attempting to read r-value (2).

I tried 3.15.2 and it changes nothing.
Comment 12 Daniel Pielmeier gentoo-dev 2015-04-04 17:26:52 UTC
(In reply to Fab from comment #11)
> (In reply to Daniel Pielmeier from comment #9)
> > for p in list(range(num_pens)):
> 
> With this, the error is the same on version 3.14.10 :
> > hp-levels[8834]: debug: num_pens = 2
> > hp-levels[8834]: debug: pen 0 {'index': 0, 'kind': 3L, 'level': 194, 'ack': True,
> > 'hp-ink': False, 'dvc': 36480L, 'level-trigger': 0, 'virgin': True, 'health': 0,
> > 'known': False, 'type': 0, 'id': 0}
> > hp-levels[8834]: debug: pen 1 {'index': 1, 'kind': 0L, 'level': 66, 'ack': True,
> > 'hp-ink': False, 'dvc': 5580L, 'level-trigger': 0, 'virgin': True, 'health': 0,
> > 'known': False, 'type': 0, 'id': 17}
> > error: Error attempting to read r-value (2).
> 
> I tried 3.15.2 and it changes nothing.

Okay so this was not the issue. I found the same problem was already fixed in hplip-3.13.4 and now it popped up again.
Comment 13 Fab 2016-09-07 09:08:59 UTC
Hi,

I discovered today that it is working now. I didn't do anything particular
since last year, just done my regular -uDN @world updates (stable system) and
kernel updates.

Last year I was on kernel 3.14 branch.
Now I have :
 - kernel 4.4 branch 
 - hplip-3.16.3 (last built on 17/05/2016  during a regular update)
 - dev-lang/python 2.7.10-r1 and 3.4.3-r1 installed

I don't know if this is the hplip update that fixed it, I can try to dowgrade to 3.14.10 to see.
Comment 14 Andreas K. Hüttel archtester gentoo-dev 2017-02-18 19:22:28 UTC
(In reply to Fab from comment #13)
> Hi,
> 
> I discovered today that it is working now. I didn't do anything particular
> since last year, just done my regular -uDN @world updates (stable system) and
> kernel updates.
> 

Good to know. If the problem reappears, plase file a new bug (and maybe mention this one there).