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

fix: typo in Python module name in module docstring #6

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

william-davies
Copy link
Contributor

I might be mistaken, but I think that the - has to be _ for the import to work. Here is my testing:

[I] ⋊> ~/my-beancount on mainline ⨯ python                                                                                          (beancount) 22:30:18
Python 3.11.5 (main, Sep 11 2023, 08:19:27) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import importlib
>>> importlib.import_module('fava_plugins.split_income')
<module 'fava_plugins.split_income' from '/Users/williamdavies/opt/miniconda3/envs/beancount/lib/python3.11/site-packages/fava_plugins/split_income.py'>
>>> importlib.import_module('fava-plugins.split_income')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/williamdavies/opt/miniconda3/envs/beancount/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'fava-plugins'
>>> importlib.import_module('fava-plugins')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/williamdavies/opt/miniconda3/envs/beancount/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'fava-plugins'
>>> importlib.import_module('fava_plugins')
<module 'fava_plugins' from '/Users/williamdavies/opt/miniconda3/envs/beancount/lib/python3.11/site-packages/fava_plugins/__init__.py'>

Please do let me know if I'm wrong! Otherwise, updating the docstring will help others avoid the head-scratching I just did :)

I might be mistaken, but I think that the `-` has to be `_` for the import to work. Here is my testing:
```
[I] ⋊> ~/my-beancount on mainline ⨯ python                                                                                          (beancount) 22:30:18
Python 3.11.5 (main, Sep 11 2023, 08:19:27) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import importlib
>>> importlib.import_module('fava_plugins.split_income')
<module 'fava_plugins.split_income' from '/Users/williamdavies/opt/miniconda3/envs/beancount/lib/python3.11/site-packages/fava_plugins/split_income.py'>
>>> importlib.import_module('fava-plugins.split_income')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/williamdavies/opt/miniconda3/envs/beancount/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'fava-plugins'
>>> importlib.import_module('fava-plugins')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/williamdavies/opt/miniconda3/envs/beancount/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'fava-plugins'
>>> importlib.import_module('fava_plugins')
<module 'fava_plugins' from '/Users/williamdavies/opt/miniconda3/envs/beancount/lib/python3.11/site-packages/fava_plugins/__init__.py'>
```
Please do let me know if I'm wrong! Otherwise, updating the docstring will help others avoid the head-scratching I just did :)
Copy link
Member

@yagebu yagebu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! :)

@yagebu yagebu merged commit fd8519f into beancount:main Mar 11, 2024
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

Successfully merging this pull request may close these issues.

2 participants