AttributeError: module 'ast' has no attribute 'parse'
程序员文章站
2024-03-25 13:34:52
...
死活查不出来,写了一个ast报这个错。
Traceback (most recent call last):
File "C:\Users\HP\Desktop\ast.py", line 13, in <module>
res = sc(path)
File "C:\Users\HP\Desktop\ast.py", line 8, in sc
ex = ast.parse(res,filename=path,mode = 'exec')
AttributeError: module 'ast' has no attribute 'parse'
终于还是被我发现了,猫腻原来在这里——命名问题。
这个文件的命名为ast.py,报错,改个名字,ast1.py,一切正常。
推荐阅读
-
AttributeError: module 'ast' has no attribute 'parse'
-
AttributeError: module 'tensorflow' has no attribute 'Session'
-
AttributeError: 'NoneType' object has no attribute 'find_all'
-
错误 AttributeError: 'NoneType' object has no attribute 'astype'
-
API项目——AttributeError: 'NoneType' object has no attribute 'decode'
-
在Django框架中偶遇报错:AttributeError: ‘str’ object has no attribute ‘decode’解决办法
-
AttributeError: ‘NoneType‘ object has no attribute ‘shape‘
-
Django 报错:‘AttributeError: ‘str‘ object has no attribute ‘decode‘‘
-
AttributeError: ‘NoneType‘ object has no attribute ‘name‘
-
【已解决】python-pip升级报错- AttributeError: 'NoneType' object has no attribute 'bytes'