Skip to content
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

Opening files with # character #92

Closed
janrygl opened this issue Oct 5, 2016 · 0 comments
Closed

Opening files with # character #92

janrygl opened this issue Oct 5, 2016 · 0 comments

Comments

@janrygl
Copy link

janrygl commented Oct 5, 2016

Creating a file with filename containing # char (e.g. aa#aa) and trying to open it with smart_open.smart_open('aa#aa') fails.

In [3]: open('aa#aa')
Out[3]: <open file 'aa#aa', mode 'r' at 0x7f4ec5b72ed0>

vs

In [2]: smart_open('aa#aa')
---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
<ipython-input-2-e0a7775bdb92> in <module>()
----> 1 s('aa#aa')

/usr/local/lib/python2.7/dist-packages/smart_open-1.2.1-py2.7.egg/smart_open/smart_open_lib.pyc in smart_open(uri, mode)
    87         # local files -- both read & write supported
    88         # compression, if any, is determined by the filename extension (.gz, .bz2)
---> 89         return file_smart_open(parsed_uri.uri_path, mode)
    90
    91     if mode in ('r', 'rb'):

/usr/local/lib/python2.7/dist-packages/smart_open-1.2.1-py2.7.egg/smart_open/smart_open_lib.pyc in file_smart_open(fname, mode)
   299         return make_closing(GzipFile)(fname, mode)
   300
--> 301     return open(fname, mode)
   302
   303

IOError: [Errno 2] No such file or directory: 'aa'
@piskvorky piskvorky added the bug label Oct 5, 2016
tmylk added a commit that referenced this issue Oct 5, 2016
@tmylk tmylk closed this as completed in 63fa57f Oct 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants