TypeError: expected str, bytes or os.PathLike object, not module
Posted Data+Science+Insight
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了TypeError: expected str, bytes or os.PathLike object, not module相关的知识,希望对你有一定的参考价值。
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
以上是关于TypeError: expected str, bytes or os.PathLike object, not module的主要内容,如果未能解决你的问题,请参考以下文章
TypeError: expected str, bytes or os.PathLike object, not module
sqlalchemy ORM 调用失败并出现 TypeError: expected bytes, str found
Python2.7 在使用BSTestRunner.py时报错TypeError: unicode argument expected, got 'str'
python报错:TypeError: sequence item 0: expected str instance, int found
TypeError: expected str, bytes or os.PathLike object, not int(解决方法)
Python 在用 Pyinstaller封装exe-TypeError: expected str, bytes or os.PathLike object, not NoneType 解决方法!