error:
Traceback (most recent call last):
File "D:\Python Program\Pworkspace\test.py", line 34, in
pd.read_csv(path)
File "C:\Users\wuqing\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\io\parsers.py", line 655, in parser_f
return _read(filepath_or_buffer, kwds)
File "C:\Users\wuqing\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\io\parsers.py", line 405, in _read
parser = TextFileReader(filepath_or_buffer, kwds)
File "C:\Users\wuqing\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\io\parsers.py", line 764, in init
self._make_engine(self.engine)
File "C:\Users\wuqing\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\io\parsers.py", line 985, in _make_engine
self._engine = CParserWrapper(self.f, self.options)
File "C:\Users\wuqing\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\io\parsers.py", line 1605, in init
self._reader = parsers.TextReader(src, **kwds)
File "pandas_libs\parsers.pyx", line 394, in pandas._libs.parsers.TextReader.cinit (pandas_libs\parsers.c:4209)
File "pandas_libs\parsers.pyx", line 712, in pandas._libs.parsers.TextReader._setup_parser_source (pandas_libs\parsers.c:8895)
OSError: Initializing from file failed
code:
temp = pd.read_csv('测试.csv')
the following code works:
temp = pd.read_csv('tmp.csv')
the following also works:
temp = pd.read_csv('测试.csv', engine='python')
如果文件名中有中文,并且不加engine时用的是engine='c',这时则会报出如下错误:OSError: Initializing from file failed
我看以前有类似问题出现,但是新版本仍然有这个bug,希望能帮忙解决
Comment From: jreback
duplicate of this: https://github.com/pandas-dev/pandas/issues/15086
the protocol changes in 3.6 for windows paths
Comment From: BruceDai003
@jreback I'm using python 3.6 in windows, this problem still exists.