locusrobotics / qgis_ros

ROS QGIS Plugin prototype
MIT License
45 stars 9 forks source link

ValueError: Empty module name in Melodic #8

Open masternibot opened 5 years ago

masternibot commented 5 years ago

In ROS Melodic I get the following python error in QGIS when loading a bagfile:

2018-10-15T14:04:54 WARNING Traceback (most recent call last): File "/home/tobin/katipo_ws/src/qgis_ros/src/qgis_ros/ui/bagfile_dialog.py", line 67, in _tabulateBagContents self.dataLoaderWidget.setTopics(metadata) File "/home/tobin/katipo_ws/src/qgis_ros/src/qgis_ros/ui/data_loader_widget.py", line 33, in setTopics topicMetadata = [t for t in topicMetadata if t[1] in TranslatorRegistry.instance().translatableTypeNames] File "/home/tobin/katipo_ws/src/qgis_ros/src/qgis_ros/ui/data_loader_widget.py", line 33, in topicMetadata = [t for t in topicMetadata if t[1] in TranslatorRegistry.instance().translatableTypeNames] File "/home/tobin/katipo_ws/src/qgis_ros/src/qgis_ros/core/translator_registry.py", line 18, in instance TranslatorRegistry() File "/home/tobin/katipo_ws/src/qgis_ros/src/qgis_ros/core/translator_registry.py", line 36, in init m = importlib.import_module(p) File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 991, in _gcd_import File "", line 930, in _sanity_check ValueError: Empty module name

I believe this is associated with the warnings that are also being generated about deprecated regular expressions: qgis_python_warnings.txt

This seems to be present when connecting to a ROS Master or reading from a bag file.

Here is the error when connecting to a fresh master:

2018-10-15T14:14:14 WARNING Traceback (most recent call last): File "/home/tobin/katipo_ws/src/qgis_ros/src/qgis_ros/ui/ros_master_dialog.py", line 61, in _checkForMaster self._getAvailableTopics() File "/home/tobin/katipo_ws/src/qgis_ros/src/qgis_ros/ui/ros_master_dialog.py", line 69, in _getAvailableTopics self.dataLoaderWidget.setTopics(topicMetadata) File "/home/tobin/katipo_ws/src/qgis_ros/src/qgis_ros/ui/data_loader_widget.py", line 33, in setTopics topicMetadata = [t for t in topicMetadata if t[1] in TranslatorRegistry.instance().translatableTypeNames] File "/home/tobin/katipo_ws/src/qgis_ros/src/qgis_ros/ui/data_loader_widget.py", line 33, in topicMetadata = [t for t in topicMetadata if t[1] in TranslatorRegistry.instance().translatableTypeNames] File "/home/tobin/katipo_ws/src/qgis_ros/src/qgis_ros/core/translator_registry.py", line 18, in instance TranslatorRegistry() File "/home/tobin/katipo_ws/src/qgis_ros/src/qgis_ros/core/translator_registry.py", line 36, in init m = importlib.import_module(p) File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 991, in _gcd_import File "", line 930, in _sanity_check ValueError: Empty module name

ablakey commented 5 years ago

Did you have the QGIS_ROS_EXTRA_TRANSLATORS envvar set? It needs a richer error message, but I think the above error may have occurred because of a wrongly parsed set of extra translators. Here's the relevant code:

# Register extra translators found in QGIS_ROS_EXTRA_TRANSLATORS.
translatorPaths = os.environ.get('QGIS_ROS_EXTRA_TRANSLATORS', '').split(',')
for p in translatorPaths:
    m = importlib.import_module(p)
    ...

The last line there is failing, I think, because the path passed into it isn't valid in some way.

masternibot commented 5 years ago

I do not have the QGIS_ROS_EXTRA_TRANSLATORS variable set.

ablakey commented 5 years ago

I can't reproduce this with Python 3.5 but for various reasons I cannot test it with 3.6. Can you try using Python 3.5 and see if it occurs?

masternibot commented 5 years ago

I am not super familiar with QGIS, I have installed Python 3.5 and replaced the python3 symlink to point to 3.5 but QGIS is still using 3.6. I am unsure how to set the version QGIS uses.

ablakey commented 5 years ago

Hm. Are you using Ubuntu 18.04? I'm going to create a Docker image of it and see if I can repeat your issue. In the meantime, I recently added some instructions for using Docker to run QGIS-ROS in a much more reliable way. If you're interested, check out the updated readme.

MarcoMers commented 5 years ago

Hello I've got the same error but i'm using Ubuntu 16.04 Xenial on a virtual machine, it happens when i launch the command:'rosrun qgis_ros start_qgis_ros' ... after that command in the console appear this message:'Failed to load Python extension for LZ4 support. LZ4 compression will not be available.'
Did you find a solution?


Here is my error message from qgis :

An error has occurred while executing Python code:

ValueError: Empty module name Traceback (most recent call last): File "/home/msimioni/corso_ws/src/qgis_ros/src/qgis_ros/ui/ros_master_dialog.py", line 61, in _checkForMaster self._getAvailableTopics() File "/home/msimioni/corso_ws/src/qgis_ros/src/qgis_ros/ui/ros_master_dialog.py", line 69, in _getAvailableTopics self.dataLoaderWidget.setTopics(topicMetadata) File "/home/msimioni/corso_ws/src/qgis_ros/src/qgis_ros/ui/data_loader_widget.py", line 33, in setTopics topicMetadata = [t for t in topicMetadata if t[1] in TranslatorRegistry.instance().translatableTypeNames] File "/home/msimioni/corso_ws/src/qgis_ros/src/qgis_ros/ui/data_loader_widget.py", line 33, in topicMetadata = [t for t in topicMetadata if t[1] in TranslatorRegistry.instance().translatableTypeNames] File "/home/msimioni/corso_ws/src/qgis_ros/src/qgis_ros/core/translator_registry.py", line 18, in instance TranslatorRegistry() File "/home/msimioni/corso_ws/src/qgis_ros/src/qgis_ros/core/translator_registry.py", line 36, in init m = importlib.import_module(p) File "/usr/lib/python3.5/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 981, in _gcd_import File "", line 933, in _sanity_check ValueError: Empty module name

ablakey commented 5 years ago

Sorry I haven't been able to work on this project in a while. I think we can get past this by handling and logging when we run into empty module names. From there we can probably figure out why they're occurring in the first place.

Let me put a branch together.