AttributeError: '<invalid type>' object has no attribute 'exit'

☆樱花仙子☆ 提交于 2019-12-13 09:44:32

问题


Throws error: Line 2: AttributeError: '<invalid type>' object has no attribute 'exit' when from sys import exit is run. How do I fix this? Problem part of code:

from sys import exit

回答1:


Did you happen to create a module or file called sys? If so you are importing from your local module rather than from the built-in Python sys module

Otherwise, these import commands are case sensitive, make sure everything is in lower case (it is in your post, but you never know):

from sys import exit


来源:https://stackoverflow.com/questions/37555355/attributeerror-invalid-type-object-has-no-attribute-exit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!