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

ImportError: cannot import name 'l_' from 'sphinx.locale' #10

Open
jhadjar opened this issue Sep 3, 2021 · 0 comments
Open

ImportError: cannot import name 'l_' from 'sphinx.locale' #10

jhadjar opened this issue Sep 3, 2021 · 0 comments

Comments

@jhadjar
Copy link
Contributor

jhadjar commented Sep 3, 2021

Running python -m unittest or coverage run -m unittest discover both raise an ImportError exception:

ImportError: Failed to import test module: gastrodon.domain
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/unittest/loader.py", line 470, in _find_test_path
    package = self._get_module_from_name(name)
  File "/usr/local/lib/python3.7/unittest/loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "/home/jugurtha/workspace/python/gastrodon/gastrodon/domain/__init__.py", line 11, in <module>
    from sphinx.locale import l_, _
ImportError: cannot import name 'l_' from 'sphinx.locale' (/home/jugurtha/workspace/python/gastrodon/venv/lib/python3.7/site-packages/sphinx/locale/__init__.py)

According to this commit sphinx-doc/sphinx@8d653a4, the l_() function was integrated into _().

Recommended action:

Change the line:

    from sphinx.locale import l_, _

to

    from sphinx.locale import _

Running python -m unittest executes with the following results

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

Note: The exception mentioned in #9 also was raised, and the proposed changes in mkdocstrings/mkdocstrings#2 were added not to have that error. These are also the changes proposed in #5

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

No branches or pull requests

1 participant