其实这个错误是早上就发现了的,但是由于代码上运行没得问题,我就纳闷了,但是可以运行代码就无伤大雅。
下午事情差不多了,想起这个问题,就来debug一下。
为了让错误更加清晰的呈现出来,我又要费大家电了<哈哈>,下面就是报的完整错误。
In [13]: import pandas as pd
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.
Traceback (most recent call last):
File "~/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2862, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-13-af55e7023913>", line 1, in <module>
import pandas as pd
File "~/anaconda3/lib/python3.6/site-packages/pandas/__init__.py", line 55, in <module>
from pandas.core.api import (
File "~/anaconda3/lib/python3.6/site-packages/pandas/core/api.py", line 24, in <module>
from pandas.core.groupby import Grouper, NamedAgg
File "~/anaconda3/lib/python3.6/site-packages/pandas/core/groupby/__init__.py", line 1, in <module>
from pandas.core.groupby.generic import ( # noqa: F401
File "~/anaconda3/lib/python3.6/site-packages/pandas/core/groupby/generic.py", line 41, in <module>
import pandas.core.algorithms as algorithms
AttributeError: module 'pandas' has no attribute 'core'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "~/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 1806, in showtraceback
stb = value._render_traceback_()
AttributeError: 'AttributeError' object has no attribute '_render_traceback_'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "~/anaconda3/lib/python3.6/site-packages/IPython/core/ultratb.py", line 1090, in get_records
return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
File "~/anaconda3/lib/python3.6/site-packages/IPython/core/ultratb.py", line 311, in wrapped
return f(*args, **kwargs)
File "~/anaconda3/lib/python3.6/site-packages/IPython/core/ultratb.py", line 345, in _fixed_getinnerframes
records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
File "~/anaconda3/lib/python3.6/inspect.py", line 1488, in getinnerframes
frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
File "~/anaconda3/lib/python3.6/inspect.py", line 1446, in getframeinfo
filename = getsourcefile(frame) or getfile(frame)
File "~/anaconda3/lib/python3.6/inspect.py", line 696, in getsourcefile
if getattr(getmodule(object, filename), '__loader__', None) is not None:
File "~/anaconda3/lib/python3.6/inspect.py", line 725, in getmodule
file = getabsfile(object, _filename)
File "~/anaconda3/lib/python3.6/inspect.py", line 709, in getabsfile
return os.path.normcase(os.path.abspath(_filename))
File "~/anaconda3/lib/python3.6/posixpath.py", line 376, in abspath
cwd = os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory
重点在后面的getcwd,报的错误是美的这个目录或者文件夹。
报错原因: 我在terminal中运行了ipython程序,由于代码更新,我将这个目录删除了,然后使用getcwd就出了问题。
这个bug我感觉应该是python的bug,但是python也没得义务来修复。
以后注意一点,python运行的项目,可能长期存在这个问题。