Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] g.gui: xml.etree.ElementTree.ParseError: no element found #1119

Closed
neteler opened this issue Nov 24, 2020 · 1 comment · Fixed by #1120
Closed

[Bug] g.gui: xml.etree.ElementTree.ParseError: no element found #1119

neteler opened this issue Nov 24, 2020 · 1 comment · Fixed by #1120
Assignees
Labels
bug Something isn't working GUI wxGUI related
Milestone

Comments

@neteler
Copy link
Member

neteler commented Nov 24, 2020

Describe the bug

I updated my laptop to the current Fedora 33, rebooted, ran make distclean, recompiled.

However, I can no longer start neither the GUI nor the stand-alone monitor...:

GRASS :grass78_git > g.gui
Launching <wxpython> GUI in the background, please wait...
Traceback (most recent call last):
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/wxgui.py", line 105, in OnInit
    mainframe = GMFrame(parent=None, id=wx.ID_ANY,
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/lmgr/frame.py", line 129, in __init__
    self._menuTreeBuilder = LayerManagerMenuData(message_handler=add_menu_error)
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/lmgr/menudata.py", line 40, in __init__
    MenuTreeModelBuilder.__init__(
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/core/menutree.py", line 71, in __init__
    xmlTree = etree.parse(filename)
  File "/usr/lib64/python3.9/xml/etree/ElementTree.py", line 1229, in parse
    tree.parse(source, parser)
  File "/usr/lib64/python3.9/xml/etree/ElementTree.py", line 580, in parse
    self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: no element found: line 1, column 0
OnInit returned false, exiting...

GRASS :grass78_git > g.version -rge
version=7.8.5dev
date=2020
revision=b593a718b
build_date=2020-11-23
build_platform=x86_64-pc-linux-gnu
build_off_t_size=8
libgis_revision=744fcaefa
libgis_date=2020-10-16T16:00:53+00:00
proj=6.3.2
gdal=3.1.4
geos=3.8.1
sqlite=3.33.0

GRASS :grass78_git > wx-config --version
3.0.5

GRASS :grass78_git > python3 --version
Python 3.9.0

With debug output

g.gisenv set=DEBUG=5

g.gui
D1/5: G_set_program_name(): g.gui
D2/5: G_file_name(): path = /home/mneteler/grassdata/openNRW_epsg25832/bonn_ndom50
D1/5: GUI: text
Launching <wxpython> GUI in the background, please wait...
D1/5: G_set_program_name(): g.gisenv
D3/5: G_option_to_separator(): key = separator -> sep = '
'
D1/5: grass.script.core.start_command(): g.gisenv -n
D1/5: G_set_program_name(): g.gisenv
D3/5: G_option_to_separator(): key = separator -> sep = '
'
D1/5: grass.script.core.start_command(): g.version -rge
D1/5: G_set_program_name(): g.version
D2/5: G_file_name(): path = /home/mneteler/grassdata/openNRW_epsg25832/bonn_ndom50
D1/5: grass.script.core.start_command(): g.message -d message=toolboxes.getMenudataFile: main_menu.xml, menudata.xml, /home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/xml/menudata.xml debug=1
D1/5: G_set_program_name(): g.message
D2/5: G_file_name(): path = /home/mneteler/grassdata/openNRW_epsg25832/bonn_ndom50
D1/5: toolboxes.getMenudataFile: main_menu.xml, menudata.xml, /home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/xml/menudata.xml
D1/5: grass.script.core.start_command(): g.message -d message=toolboxes.getMenudataFile: no user defined files debug=2
D1/5: G_set_program_name(): g.message
D2/5: G_file_name(): path = /home/mneteler/grassdata/openNRW_epsg25832/bonn_ndom50
D2/5: toolboxes.getMenudataFile: no user defined files
Traceback (most recent call last):
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/wxgui.py", line 105, in OnInit
    mainframe = GMFrame(parent=None, id=wx.ID_ANY,
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/lmgr/frame.py", line 129, in __init__
    self._menuTreeBuilder = LayerManagerMenuData(message_handler=add_menu_error)
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/lmgr/menudata.py", line 40, in __init__
    MenuTreeModelBuilder.__init__(
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/core/menutree.py", line 71, in __init__
    xmlTree = etree.parse(filename)
  File "/usr/lib64/python3.9/xml/etree/ElementTree.py", line 1229, in parse
    tree.parse(source, parser)
  File "/usr/lib64/python3.9/xml/etree/ElementTree.py", line 580, in parse
    self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: no element found: line 1, column 0
OnInit returned false, exiting...
D1/5: G_set_program_name(): g.gisenv
D3/5: G_option_to_separator(): key = separator -> sep = '/'

Indeed, the menudata.xml file is empty:

ls -la /home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/xml/menudata.xml 
-rw-r--r-- 1 mneteler mneteler 0 Nov 23 22:16 /home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/xml/menudata.xml

So I tried to re-generate it, and deleted the empty files (two XML files). Then with make I get

make /home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/xml/module_items.xml
make[1]: Entering directory '/home/mneteler/software/grass78_git/gui/wxpython'
make[1]: '/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/xml/module_items.xml' is up to date.
make[1]: Leaving directory '/home/mneteler/software/grass78_git/gui/wxpython'
make xml/menudata.xml
make[1]: Entering directory '/home/mneteler/software/grass78_git/gui/wxpython'
GISRC=/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/demolocation/.grassrc78 GISBASE=/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu PATH="/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/bin:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/bin:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/scripts:$PATH" PYTHONPATH="/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/etc/python:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython:$PYTHONPATH" LD_LIBRARY_PATH="/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/bin:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/bin:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/scripts:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/lib:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/lib:" LC_ALL=C LANG=C LANGUAGE=C python3 core/toolboxes.py > xml/menudata.xml
Traceback (most recent call last):
  File "/home/mneteler/software/grass78_git/gui/wxpython/core/toolboxes.py", line 878, in <module>
    sys.exit(main())
  File "/home/mneteler/software/grass78_git/gui/wxpython/core/toolboxes.py", line 861, in main
    tree = createTree(distributionRootFile=mainFile, userRootFile=None,
  File "/home/mneteler/software/grass78_git/gui/wxpython/core/toolboxes.py", line 267, in createTree
    return toolboxes2menudata(mainMenu=mainMenu,
  File "/home/mneteler/software/grass78_git/gui/wxpython/core/toolboxes.py", line 299, in toolboxes2menudata
    _expandToolboxes(root, toolboxes)
  File "/home/mneteler/software/grass78_git/gui/wxpython/core/toolboxes.py", line 416, in _expandToolboxes
    idx = items.getchildren().index(subtoolbox)
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'
make[1]: *** [Makefile:42: xml/menudata.xml] Error 1
make[1]: Leaving directory '/home/mneteler/software/grass78_git/gui/wxpython'
make: [Makefile:32: default] Error 2 (ignored)
make xml/module_tree_menudata.xml
make[1]: Entering directory '/home/mneteler/software/grass78_git/gui/wxpython'
GISRC=/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/demolocation/.grassrc78 GISBASE=/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu PATH="/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/bin:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/bin:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/scripts:$PATH" PYTHONPATH="/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/etc/python:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython:$PYTHONPATH" LD_LIBRARY_PATH="/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/bin:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/bin:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/scripts:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/lib:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/lib:" LC_ALL=C LANG=C LANGUAGE=C python3 core/toolboxes.py "module_tree" > xml/module_tree_menudata.xml
Traceback (most recent call last):
  File "/home/mneteler/software/grass78_git/gui/wxpython/core/toolboxes.py", line 878, in <module>
    sys.exit(main())
  File "/home/mneteler/software/grass78_git/gui/wxpython/core/toolboxes.py", line 861, in main
    tree = createTree(distributionRootFile=mainFile, userRootFile=None,
  File "/home/mneteler/software/grass78_git/gui/wxpython/core/toolboxes.py", line 267, in createTree
    return toolboxes2menudata(mainMenu=mainMenu,
  File "/home/mneteler/software/grass78_git/gui/wxpython/core/toolboxes.py", line 299, in toolboxes2menudata
    _expandToolboxes(root, toolboxes)
  File "/home/mneteler/software/grass78_git/gui/wxpython/core/toolboxes.py", line 416, in _expandToolboxes
    idx = items.getchildren().index(subtoolbox)
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'
make[1]: *** [Makefile:46: xml/module_tree_menudata.xml] Error 1
make[1]: Leaving directory '/home/mneteler/software/grass78_git/gui/wxpython'
make: [Makefile:33: default] Error 2 (ignored)
make menustrings.py
make[1]: Entering directory '/home/mneteler/software/grass78_git/gui/wxpython'
/usr/bin/install -c  -m 644 xml/menudata.xml /home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/xml/menudata.xml
/usr/bin/install -c  -m 644 xml/module_tree_menudata.xml /home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/xml/module_tree_menudata.xml
GISRC=/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/demolocation/.grassrc78 GISBASE=/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu PATH="/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/bin:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/bin:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/scripts:$PATH" PYTHONPATH="/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/etc/python:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython:$PYTHONPATH" LD_LIBRARY_PATH="/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/bin:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/bin:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/scripts:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/lib:/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/lib:" LC_ALL=C LANG=C LANGUAGE=C python3 core/menutree.py "manager" >> menustrings.py
Traceback (most recent call last):
  File "/home/mneteler/software/grass78_git/gui/wxpython/core/menutree.py", line 254, in <module>
    menudata = LayerManagerMenuData(filename)
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/lmgr/menudata.py", line 40, in __init__
    MenuTreeModelBuilder.__init__(
  File "/home/mneteler/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/core/menutree.py", line 71, in __init__
    xmlTree = etree.parse(filename)
  File "/usr/lib64/python3.9/xml/etree/ElementTree.py", line 1229, in parse
    tree.parse(source, parser)
  File "/usr/lib64/python3.9/xml/etree/ElementTree.py", line 580, in parse
    self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: no element found: line 1, column 0
make[1]: *** [Makefile:51: menustrings.py] Error 1
make[1]: Leaving directory '/home/mneteler/software/grass78_git/gui/wxpython'
make: [Makefile:34: default] Error 2 (ignored)

Elsewhere I found this hint:

https://docs.python.org/3.8/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.getchildren
--> Deprecated since version 3.2, will be removed in version 3.9: Use list(elem) or iteration.

Help welcome :-)

@neteler neteler added bug Something isn't working GUI wxGUI related labels Nov 24, 2020
@neteler neteler added this to the 7.8.5 milestone Nov 24, 2020
wenzeslaus added a commit to wenzeslaus/grass that referenced this issue Nov 25, 2020
Element.getchildren() and getiterator() are deprecated since Python
version 3.2 and removed in version 3.9.

Using simpler replacements list(), in, and iter().

Fixes OSGeo#1119.
@wenzeslaus wenzeslaus self-assigned this Nov 25, 2020
@neteler
Copy link
Member Author

neteler commented Nov 25, 2020

I suggest to merge #1120, it solves the problem.

wenzeslaus added a commit that referenced this issue Nov 26, 2020
Element.getchildren() and getiterator() are deprecated
since Python version 3.2 and removed in version 3.9.

Using simpler replacements list(), in, and iter().

Fixes #1119.
neteler pushed a commit that referenced this issue Nov 26, 2020
Element.getchildren() and getiterator() are deprecated
since Python version 3.2 and removed in version 3.9.

Using simpler replacements list(), in, and iter().

Fixes #1119.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working GUI wxGUI related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants