Bug report #16028

Metasearch/QGIS3: failing view results as xml

Added by Richard Duivenvoorde over 7 years ago. Updated almost 7 years ago.

Status:Closed
Priority:High
Assignee:Tom Kralidis
Category:MetaSearch Catalogue Client
Affected QGIS version:master Regression?:Yes
Operating System: Easy fix?:Yes
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:23943

Description

Trying out Metasearch here on current QGIS3 master, using the 'View search results as XML' give the error you see in the screenshot.

Probably something to do with python3 handling strings?

TypeError: a bytes-like object is required, not 'str' 
Traceback (most recent call last):
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/plugins/MetaSearch/dialogs/maindialog.py", line 807, in show_xml
    request_html = highlight_xml(self.context, self.catalog.request)
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/plugins/MetaSearch/util.py", line 128, in highlight_xml
    body = highlight(prettify_xml(xml), XmlLexer(), hformat)
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/plugins/MetaSearch/util.py", line 113, in prettify_xml
    if xml.count('\
') > 5:  # likely already pretty printed
TypeError: a bytes-like object is required, not 'str'

Installed version: 0.3.4 (in /home/richard/bin/qgis_all/master/debug/share/qgis/python/plugins/MetaSearch)

Selection_012.png - error dialog plus search (249 KB) Richard Duivenvoorde, 2017-01-02 06:24 AM

History

#1 Updated by Tom Kralidis about 7 years ago

Richard: thanks for the info. Looks like MetaSearch needs a Python 2 to 3 migration.

#2 Updated by Tom Kralidis about 7 years ago

Richard: can you try master branch again? Should be fixed now.

#3 Updated by Giovanni Manghi about 7 years ago

  • Status changed from Open to Feedback

#4 Updated by Richard Duivenvoorde about 7 years ago

Hi Tom,

A fresh compile/install today I get a owslib not found error. I thought that was included isn't it? I'm not aware of the need to install it separate?

ImportError: No module named 'owslib' 
Traceback (most recent call last):
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/qgis/utils.py", line 337, in startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/plugins/MetaSearch/__init__.py", line 29, in classFactory
    from MetaSearch.plugin import MetaSearchPlugin
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/qgis/utils.py", line 647, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/plugins/MetaSearch/plugin.py", line 34, in 
    from MetaSearch.dialogs.maindialog import MetaSearchDialog
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/qgis/utils.py", line 647, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/plugins/MetaSearch/dialogs/maindialog.py", line 48, in 
    from owslib.csw import CatalogueServiceWeb
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/qgis/utils.py", line 647, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named 'owslib'

#5 Updated by Jürgen Fischer about 7 years ago

Richard Duivenvoorde wrote:

Hi Tom,

A fresh compile/install today I get a owslib not found error. I thought that was included isn't it? I'm not aware of the need to install it separate?

[...]

Not anymore. In qgis3 we only have `pyspatialite` in python/ext-libs - because our targets (for debian/ubuntu and osgeo4w) have more update version of the previously shipped internal copies and didn't use those anyway. Support in 2.18 was also trimmed, but has some more as that still supports jessie/trusty, which don't contain some of the dependencies or older dependencies than our internal copies.

#6 Updated by Giovanni Manghi almost 7 years ago

  • Status changed from Feedback to Open

#7 Updated by Tom Kralidis almost 7 years ago

  • Description updated (diff)
  • Easy fix? set to Yes
  • Regression? set to Yes

Should we close this ticket given the packaging issues are unrelated?

#8 Updated by Giovanni Manghi almost 7 years ago

  • Status changed from Open to Feedback
  • Priority changed from Normal to High

#9 Updated by Giovanni Manghi almost 7 years ago

  • Resolution set to invalid
  • Status changed from Feedback to Closed

Closing for lack of feedback.

Also available in: Atom PDF