-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
TST: win32 paths cannot be turned into URLs by prefixing them with "file://" #4580
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
Conversation
@@ -27,6 +27,12 @@ | |||
from pandas.util.testing import makeCustomDataframe as mkdf | |||
|
|||
|
|||
import urlparse, urllib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you put this in pandas/io/common.py ?
|
|
||
def path2url(path): | ||
return urlparse.urljoin( | ||
'file:', urllib.pathname2url(path)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this you can take out
@cpcloud can take a look...i think this is ONLY used in tests for io/html (though maybe make a more general mechansim?) |
@mindw If you feel like renaming the test that's fine, as long as it passes. Also, your code is not Python 3 compatible without running Those Travis errors are spurious errors unrelated to your code. |
Here's what you need for Py3 compatibility: In Python 3:
Python 2:
Please add these to the top of io/common in the midst of the imports under the appropriate branch. |
Fixes submitted as requested. BTW six 1.4.1 is out - it includes urllib fixes. I was wandering what was the rational to avoid using it (internally or as a dependency)? |
import urllib.parse as urlparse | ||
from urllib.parse import urljoin | ||
from urllib.request import pathname2url | ||
from io import StringIO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should import StringIO
from compat. only io specific things should come from here.
On your six comment: There were a number of items that we needed to tweak from six. For example, That said, as noted in the release notes, and the LICENSE directory (and I think in I really like the six module and I think the author used a very elegant model for turning a single file package into a module with multiple (and dynamic) namespaces, but I like the explicitness and clarity of having those imports localized into a single location within pandas. I didn't even realize that the url imports weren't a part of |
Side note: please rebase on top of current master. |
@mindw ping |
On vacation - I'll handle this once back 10/01. |
@mindw how's this coming? (I see you just got back)....no pressure! |
Here you go - I was unable to re-use this issue for the master rebase. See #5100. |
closing in favor of #5100 |
For future reference, all Github cares about is the branch name, so if you |
Duly noted . ;]
|
supplanted by #5100 |
see http://stackoverflow.com/questions/11687478/convert-a-filename-to-a-file-url