简体   繁体   中英

cannot import name 'application' in python 3

from pywinauto import application

Error message:

Traceback (most recent call last): File "D:/Program Files/Python/pywinauto.py", line 1, in from pywinauto import application File "D:/Program Files/Python\\pywinauto.py", line 1, in from pywinauto import application ImportError: cannot import name 'application'

From their documentation:

from pywinauto.application import Application

Source: https://github.com/pywinauto/pywinauto

你不应该用 python 包的名称命名你的脚本。这将使你的 python 脚本在相同的位置尝试从这些文件而不是原始包中导入模块。在这里你不应该将脚本命名为“pywinauto.py”。重命名并尝试。此外,在同一位置不应有任何名为“pywinauto.py”的脚本。

The real problem is in the script name. It shouldn't be called pywinauto.py because Python will try to import it instead of real pywinauto package. Please rename your script.

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