3

I have attempted to install PYAHK via pip install pyahk as well as python setup.py install

# pip --version
pip 9.0.1 from c:\python36\lib\site-packages (python 3.6)

# python --version
Python 3.6.1

both of these error out with the following message:

Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\ca\AppData\Local\Temp\pip-build-as2lv10i\pyahk\setup.py", line 3, in <module>
    import ahk
    File "C:\Users\ca\AppData\Local\Temp\pip-build-as2lv10i\pyahk\ahk\__init__.py", line 7, in <module>
    from script import Function, Script
ModuleNotFoundError: No module named 'script'

However ... the module in question .\ahk\script.py does in fact exist

PYAHK
│   .hgignore
│   .hgtags
│   .hg_archival.txt
│   LICENSE.txt
│   pylintrc
│   README.rst
│   runtests.py
│   setup.py
│   __init__.py
│
├───ahk
│   │   ahk.py
│   │   control.py
│   │   script.py
│   │   __init__.py
│   │
│   └───__pycache__
│           __init__.cpython-36.pyc
│
├───doc
│   │   ahk.rst
│   │   conf.py
│   │   control.rst
│   │   index.rst
│   │   make.bat
│   │   script.rst
│   │
│   └───_templates
│           layout.html
│
└───test
        test_ahk.py
        test_control.py
        test_script.py
        __init__.py

is there a reason that a module cant be named script.py in python3? Did I miss something in the install?

1
  • 1
    I don't know if it's your only problem, but your link says that package is for python 2.7 only, py3k is not supported. Commented Jun 26, 2017 at 17:35

1 Answer 1

6

from script import was a relative import in Python 2 but became an absolute import in Python 3; there is no global module 'script' hence the error. In Py3 it must be from ahk.script import or relative import from .script import.

Sign up to request clarification or add additional context in comments.

2 Comments

How do we fix the command in the codelab to work: codelabs.developers.google.com/codelabs/tensorflow-for-poets/#3
That should be a separate question with enough information copied from the page to the question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.