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

Error: Importing module failed #28

Closed
scanta2 opened this issue Apr 10, 2020 · 11 comments
Closed

Error: Importing module failed #28

scanta2 opened this issue Apr 10, 2020 · 11 comments

Comments

@scanta2
Copy link

scanta2 commented Apr 10, 2020

Hi,
I have been following the instructions in the readme on how to use this extension directly in the beancount ledger folder, or installed via pip. All I get is an error "Importing module "fava_investor" failed.".

Is there anything I am missing?

@redstreet
Copy link
Owner

redstreet commented Apr 10, 2020

The git repo name unfortunately has a hyphen, which is not valid in python imports. I'll rename the repo. Meanwhile, move your clone:

mv fava-investor fava_investor

Assuming you did this in the same directory of your beancount source, invoke the fava extension using the line below, given the actual module lives in a subdirectory that is also named fava_investor:

# 2010-01-01 custom "fava-extension" "fava_investor.fava_investor" "{...}"

Let me know if that worked for you. I'll add a note to the README.

@scanta2
Copy link
Author

scanta2 commented Apr 11, 2020 via email

@redstreet
Copy link
Owner

Did you try running the example? See CONTRIBUTING.md (I just moved it to README.md).

If that doesn't work, you might want to install the latest released version of fava.

@redstreet
Copy link
Owner

"Importing module "fava_investor" failed."

That usually means the module was not found. Try running python3 interactively and typing:
import fava_investor.fava_investor

That should succeed. Does it?

@ghost
Copy link

ghost commented Apr 11, 2020

EDIT: Just forget. I installed the module argh and now your example.bc file works.
I left just in case somebody has the same error. The solution is:
pip3 install argh

Regards and thank you for your work!

Tino.

Hi, the same here... I post the output to your last command:

Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import fava_investor.fava_investor
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/tinotuno/fava_investor/fava_investor/__init__.py", line 6, in <module>
    from .modules.assetalloc_class import libassetalloc
  File "/Users/tinotuno/fava_investor/fava_investor/modules/assetalloc_class/libassetalloc.py", line 4, in <module>
    import argparse,argcomplete,argh
ModuleNotFoundError: No module named 'argh'
>>>

@redstreet
Copy link
Owner

redstreet commented Apr 11, 2020

Ah okay, that helps! This should fix it:
pip install argh argcomplete

@redstreet
Copy link
Owner

Added to README.md

@redstreet
Copy link
Owner

@scanta2, please reopen if you're still having trouble.

@ghost
Copy link

ghost commented Apr 11, 2020

@redstreet you forgot
pip3 install argh
Without that doesn't work. pip3 install argcomplete is not enough.

@redstreet
Copy link
Owner

Ah, thanks for catching this. Will add.

@redstreet redstreet changed the title Using the extension Error: Importing module failed Apr 11, 2020
@redstreet
Copy link
Owner

If either of you want to contribute the below, that'd be cool:
#25

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

2 participants