$ sudo hp-doctor -i
Traceback (most recent call last):
File "/usr/bin/hp-doctor", line 42, in <module>
check_extension_module_env('cupsext')
File "/usr/share/hplip/base/g.py", line 340, in check_extension_module_env
python_ver = xint((sys.version).split(' ')[0]) #find the current python version ; xint() to convert string to int, returns a list
File "/usr/share/hplip/base/g.py", line 332, in xint
return l
UnboundLocalError: local variable 'l' referenced before assignment
# Edit: pdb.set_trace()
$ sudo hp-doctor
> /usr/share/hplip/base/g.py(333)xint()
-> return l
(Pdb) ver
'2.7.15rc1'
(Pdb) ver.split('.')
['2', '7', '15rc1']
(Pdb) [int(x) for x in ver.split('.')]
*** ValueError: invalid literal for int() with base 10: '15rc1'
(Pdb)
Code work-around:
# Convert string to int and return a list.
def xint(ver):
try:
l = [int(x) for x in ver.split('.')]
except:
l = []
for x in ver.split('.'):
try: l.append(int(x))
except: l.append(None)
return l
$ sudo hp-doctor
error: cupsext not present in the system. Please re-install HPLIP.
# debug info: [2, 7, None]
Solution for me is `python3 hp-doctor` instead:
$ python3 -VV
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0]
Same on bionic 18.04:
$ python2 --version
Python 2.7.15rc1
$ sudo hp-doctor -i hp-doctor" , line 42, in <module> extension_ module_ env('cupsext' ) hplip/base/ g.py", line 340, in check_extension _module_ env version) .split( ' ')[0]) #find the current python version ; xint() to convert string to int, returns a list hplip/base/ g.py", line 332, in xint hplip/base/ g.py(333) xint()
Traceback (most recent call last):
File "/usr/bin/
check_
File "/usr/share/
python_ver = xint((sys.
File "/usr/share/
return l
UnboundLocalError: local variable 'l' referenced before assignment
# Edit: pdb.set_trace()
$ sudo hp-doctor
> /usr/share/
-> return l
(Pdb) ver
'2.7.15rc1'
(Pdb) ver.split('.')
['2', '7', '15rc1']
(Pdb) [int(x) for x in ver.split('.')]
*** ValueError: invalid literal for int() with base 10: '15rc1'
(Pdb)
Code work-around:
l. append( int(x))
l. append( None)
# Convert string to int and return a list.
def xint(ver):
try:
l = [int(x) for x in ver.split('.')]
except:
l = []
for x in ver.split('.'):
try:
except:
return l
$ sudo hp-doctor
error: cupsext not present in the system. Please re-install HPLIP.
# debug info: [2, 7, None]
Solution for me is `python3 hp-doctor` instead:
$ python3 -VV
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0]