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

Can't import inference #28

Closed
flamablecharlie opened this issue Jan 18, 2018 · 5 comments
Closed

Can't import inference #28

flamablecharlie opened this issue Jan 18, 2018 · 5 comments
Assignees
Labels

Comments

@flamablecharlie
Copy link

So using the example, I should be able to use

from nmt-chatbot.inference import inference

But when I try, I get this:

>>> from nmt-chatbot.inference import inference
  File "<stdin>", line 1
    from nmt-chatbot.inference import inference
            ^
SyntaxError: invalid syntax
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
  File "<stdin>", line 1
    from nmt-chatbot.inference import inference
            ^
SyntaxError: invalid syntax
>>> 

So is there a way to correctly import it?

@umangkr
Copy link

umangkr commented Jan 18, 2018

just rename the "nmt-chatbot" filename to anything else like "chatbot"
and then use "from chatbot.inference import inference"

@flamablecharlie
Copy link
Author

That didn't work. :(

@Hyperclaw79
Copy link

Make sure you are not doing this from within the nmt-chatbot folder.

@flamablecharlie
Copy link
Author

Completely separate folder. Same result.

@daniel-kukiela
Copy link
Owner

That's an unfortunate mistake to use dash in module name.
But with dash replaced with underscore:
from nmt_chatbot.inference import inference
that works for me.

Please doublecheck that.

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

No branches or pull requests

4 participants