'QString' object has no attribute 'endswith'
Closed this issue · 7 comments
Version: Customizer 4.1.5 (Zip Release) - Git: 42c1367
Linux Distribution: Linux 4.8.0-56-generic #61~16.04.1-Ubuntu SMP Wed Jun 14 11:58:22 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[Xubuntu 16.04.1]
When I go to select an ISO Image 'Select ISO' this error message pops up: here
When the command is ran in the Terminal I get the following output:
An Exception occurred while a thread was running: Type: <type 'exceptions.AttributeError'> Details: 'QString' object has no attribute 'endswith'
I used the following guide to install it onto the system and I made sure the system was up-to-date and the dependencies met.
EDIT 1: Customizer 4.1.4 (old stable) doesn't give me this error.
same issues.
Linux 4.10.0-24-generic #28-Ubuntu SMP Wed Jun 14 08:14:34 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Ubuntu GNOME 17.04
same issue with the master on Ubuntu 16.04 with multiple ubuntu ISO images.
Linux 4.4.0-79-generic #100-Ubuntu SMP Wed May 17 19:58:14 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Hm, that's odd. I can assume y'all are still using the QT4 version under python2, from the instructions you followed on the wiki.
The quick fix I guess is to use python3 installer.py
and allow it to install the modern version with the QT5 packages.
Since I include customizer itself on ISOs I generate, and the trend for 16.04 and beyond has been bundling python3-minimal on the ISO, and I tend to replace the browser with qupzilla, I end up having the QT5 libraries on my ISO anyway, replacing the 'dead weight' that is firefox.
I'll go investigate anyway, cause I'm gonna need a console traceback of where the error occured.
Hm, a quick search while I'm waiting for my test VM to install shows one possible location in the code
where config.ISO might now be a QString. Googling the error tells me that at some point, endswith became endsWith on QStrings on python2 and qt4/5.
So it's a good indicator this problem will simply evaporate if run with python3 and all the native unicode goodness that provides, upon which one must paper over with QStrings for enforcing unicode on Python2.
Yeah, a quick google shows this is the case.
_One_ way to avoid these games is using Python 3, where all strings are unicode strings, and consequently, PyQt has eliminated QString altogether..
says https://riverbankcomputing.com/pipermail/pyqt/2016-October/038256.html
Sorry for the annoyance, I'll see if I can paper over the issue for python2/qt4 users.
I've never touched any code in that file so far, according to the Blame report, all of the code in extract.py came from fluxer with the exception of two lines where people sent in corrections to messages printed on screen.
From that mailing list post, it appears I can just cast config.ISO to unicode for this.
elif not config.ISO.endswith('.iso'):
would become
elif not unicode(config.ISO).endswith('.iso'):
I can give that a shot in a little while.
On second thought, I think I'd probably go with:
elif not u'{}'.format(config.ISO).endswith('.iso'):
Committed what I assume is the fix; affected users may test it from the devel branch.
https://github.com/kamilion/customizer/tree/development
Also updated kamikazi's setup script if anyone wants a reference.
https://github.com/kamilion/kamikazi-core/blob/master/buildscripts/xenial/setup-build-environment.sh
runs ->
https://github.com/kamilion/kamikazi-core/blob/master/buildscripts/xenial/19-add-iso-customizer.sh
(which is also what gets run during an image build)
Edit: Tested it on python3/qt5, I got no error extracting ISO, so I assume it should work for python2/qt4. Please test, and confirm, and I'll push devel -> master.
built development branch with make deb; uninstalled with dpkg -r before installing devel version but left in place customizer.conf.
Failure to launch with, and without pkexec, and output:
'Traceback (most recent call last):
File "/usr/sbin/customizer-gui", line 29, in
import lib.config as config
File "/usr/share/customizer/lib/config.py", line 46, in
PURGE_KERNEL = '{}'.format(conf.get('saved', 'PURGE_KERNEL'))
File "/usr/lib/python2.7/ConfigParser.py", line 623, in get
return self._interpolate(section, option, value, d)
File "/usr/lib/python2.7/ConfigParser.py", line 691, in _interpolate
self._interpolate_some(option, L, rawval, section, vars, 1)
File "/usr/lib/python2.7/ConfigParser.py", line 700, in _interpolate_some
p = rest.find("%")
AttributeError: 'bool' object has no attribute 'find''
@jotebe Well, you just explained yourself why you ran into #171 with "but left in place customizer.conf".
https://github.com/kamilion/customizer/blob/master/data/customizer.conf#L21
You'll have to fix your own customizer.conf file now by adding the fields, which are now correctly populated in the default configuration installed with the package.