Skip to content

Bug with Chinese characters in file path #17188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wuqingthu opened this issue Aug 7, 2017 · 2 comments
Closed

Bug with Chinese characters in file path #17188

wuqingthu opened this issue Aug 7, 2017 · 2 comments
Labels
Duplicate Report Duplicate issue or pull request IO Data IO issues that don't fit into a more specific label Windows Windows OS

Comments

@wuqingthu
Copy link

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,希望能帮忙解决

@jreback
Copy link
Contributor

jreback commented Aug 7, 2017

duplicate of this: #15086

the protocol changes in 3.6 for windows paths

@jreback jreback closed this as completed Aug 7, 2017
@jreback jreback added IO Data IO issues that don't fit into a more specific label Duplicate Report Duplicate issue or pull request Windows Windows OS labels Aug 7, 2017
@jreback jreback added this to the No action milestone Aug 7, 2017
@BruceDai003
Copy link

@jreback I'm using python 3.6 in windows, this problem still exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request IO Data IO issues that don't fit into a more specific label Windows Windows OS
Projects
None yet
Development

No branches or pull requests

3 participants