Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

ModuleNotFoundError: No module named 'console' #44

Open
lukehutch opened this issue Sep 8, 2019 · 1 comment
Open

ModuleNotFoundError: No module named 'console' #44

lukehutch opened this issue Sep 8, 2019 · 1 comment

Comments

@lukehutch
Copy link

If I git clone the rosjava packages into ~/catkin_ws/src then do catkin_make, I get several errors of the following form:

Traceback (most recent call last):
  File "/home/luke/catkin_ws/src/genjava/scripts/genjava_gradle_project.py", line 11, in <module>
    import genjava
  File "/home/luke/catkin_ws/devel/lib/python3.7/site-packages/genjava/__init__.py", line 35, in <module>
    exec(__fh.read())
  File "<string>", line 39, in <module>
  File "/home/luke/catkin_ws/src/genjava/src/genjava/genjava_main.py", line 45, in <module>
    import rosjava_build_tools
  File "/home/luke/catkin_ws/devel/lib/python3.7/site-packages/rosjava_build_tools/__init__.py", line 35, in <module>
    exec(__fh.read())
  File "<string>", line 7, in <module>
ModuleNotFoundError: No module named 'console'

What seems to be happening is that ~/catkin_ws/devel/lib/python3.7/site-packages/rosjava_build_tools/__init__.py is calling exec(__fh.read()) on the file ~/catkin_ws/src/rosjava_build_tools/src/rosjava_build_tools/__init__.py, which includes the line import console, which is supposed to import ~/catkin_ws/src/rosjava_build_tools/src/rosjava_build_tools/console.py. However, console.py is not found, because the Python package path doesn't include ~/catkin_ws/src/rosjava_build_tools/src/rosjava_build_tools.

To confound things, Python includes a (non-default) package console, which if installed, will trigger errors of the following form instead when import console is invoked:

Traceback (most recent call last):
  File "/home/luke/catkin_ws/src/genjava/scripts/genjava_gradle_project.py", line 11, in <module>
    import genjava
  File "/home/luke/catkin_ws/devel/lib/python3.7/site-packages/genjava/__init__.py", line 35, in <module>
    exec(__fh.read())
  File "<string>", line 39, in <module>
  File "/home/luke/catkin_ws/src/genjava/src/genjava/genjava_main.py", line 45, in <module>
    import rosjava_build_tools
  File "/home/luke/catkin_ws/devel/lib/python3.7/site-packages/rosjava_build_tools/__init__.py", line 35, in <module>
    exec(__fh.read())
  File "<string>", line 7, in <module>
  File "/home/luke/.local/lib/python3.7/site-packages/console/__init__.py", line 36, in <module>
    _CHOSEN_PALETTE = _choose_palette()
  File "/home/luke/.local/lib/python3.7/site-packages/console/detection.py", line 90, in choose_palette
    result, pal = detect_palette_support(basic_palette=pal)
  File "/home/luke/.local/lib/python3.7/site-packages/console/detection.py", line 207, in detect_palette_support
    result, pal_name, basic_palette = _find_basic_palette(result)
  File "/home/luke/.local/lib/python3.7/site-packages/console/detection.py", line 252, in _find_basic_palette
    if get_terminal_color('index', 2)[0][:2] == '4e':
  File "/home/luke/.local/lib/python3.7/site-packages/console/detection.py", line 481, in get_terminal_color
    with TermStack() as fd:
  File "/home/luke/.local/lib/python3.7/site-packages/console/detection.py", line 52, in __enter__
    self.orig_attrs = self.termios.tcgetattr(self.fd)
termios.error: (25, 'Inappropriate ioctl for device')
@LeroyR
Copy link

LeroyR commented Sep 19, 2019

python3 does not allow implicit local imports.

-> CentralLabFacilities@524bf63

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants