Search code examples
pythonurlparse

What is scheme 'c' in urlparse in Python?


I think this is a bug since the documentation does not mention anything about a scheme 'c'.

Why does the output of the following code out 'c' ? What is scheme 'c' ? As mentioned before the scheme 'c' does not exist in the documentation.

from urllib.parse import urlparse

print(urlparse('C:/ProgramData/Anaconda3/lib/site-packages/impala/thrift/ExecStats.thrift').scheme)

By the way I am using Anaconda3.


Solution

  • Garbage in, garbage out.

    You've told urlparse to parse something that is not a URL. urlparse did its best. In this case, the C: looks like a URL scheme specifier, like the "http:" in http://blah.blah.blah/..., so urlparse decides the scheme is c.