TypeError: expected str, bytes or os.PathLike object, not module
目录
TypeError: expected str, bytes or os.PathLike object, not module
#问题:
未提供path的实际值;
with open(path, 'r') as f:
encoding = f.encoding
df = pd.read_csv(path,sep=sep, encoding=encoding)
#解决:
提供文件读取的路径;
path = "D:\\test\\repo\\data.csv"
path = "D:\\test\\repo\\data.csv"
with open(path, 'r') as f:
encoding = f.encoding
df = pd.read_csv(path,sep=sep, encoding=encoding)
#完整错误:
Traceback (most recent call last):
File "test.py", line 89, in <module>
data = process(data_dir)
File "deploy+test.py", line 22, in inference_process
with open(path, 'r') as f:
TypeError: expected str, bytes or os.PathLike object, not module
参考:python
参考:pandas