简体   繁体   中英

How can I fix “ImportError: cannot import name 'printmsg'”

When building an apk using buildozer I am getting the error that boils down to getting the error calling automake w/o arguments:

$ automake
Traceback (most recent call last):
  File "/usr/local/bin/automake", line 11, in <module>
    load_entry_point('automake==0.1.3', 'console_scripts', 'automake')()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 487, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2728, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2346, in load
    return self.resolve()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2352, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.5/dist-packages/automake/cli.py", line 6, in <module>
    from utils import printmsg
ImportError: cannot import name 'printmsg'

I already reinstalled automake. and here are the relevant versions:

$ sudo pip install automake
Requirement already satisfied: automake in /usr/local/lib/python3.5/dist-packages (0.1.3)
Requirement already satisfied: click in /usr/local/lib/python3.5/dist-packages (from automake) (7.0)
Requirement already satisfied: watchdog in /usr/local/lib/python3.5/dist-packages (from automake) (0.9.0)
Requirement already satisfied: PyYAML>=3.10 in /usr/local/lib/python3.5/dist-packages (from watchdog->automake) (3.13)
Requirement already satisfied: argh>=0.24.1 in /usr/local/lib/python3.5/dist-packages (from watchdog->automake) (0.26.2)
Requirement already satisfied: pathtools>=0.1.1 in /usr/local/lib/python3.5/dist-packages (from watchdog->automake) (0.1.2)

The 0.1.3 release of the project you are using is simply broken. It can't work because it's cli module assumes that the directory of the automake package is itself on the Python path and so automake.utils can be imported as utils .

On your system, instead of throwing an ImportError , that from utils import printmsg line has found a different top-level utils module elsewhere. It doesn't matter what was found, or where, because it is not the correct module.

The author did commit a partial fix for this problem but apparently missed the automake/cli.py file when they did this. You could manually repair it (replace from utils with from .utils in /usr/local/lib/python3.5/dist-packages/automake/cli.py ).

If you were looking for the GNU automake tool , then you don't want this Python project. Given that you are building a Kivy APK, you are almost certainly looking for the GNU project, not this one.

After filing an issue with the automake Python project , the author agreed their choice of name could cause conflicts and they removed it from PyPI.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM