-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
type:bugSomething isn't working as expectedSomething isn't working as expected
Description
Summary
bart_vs_bikes.py script (from example folder) doesn't work on Windows. HttpError is thrown, seems that problem is in function from_data_file where os.path.join is used.
Example is working correctly on Linux.
Steps to reproduce
What are the steps we should take to reproduce the bug:
- from streamlit folder:
$ cd examples
$ streamlit run bart_vs_bikes.py
Expected behavior:
No Error.
Actual behavior:
HTTPError: HTTP Error 404: Not Found
File "d:\programs\anaconda3\lib\site-packages\streamlit\ScriptRunner.py", line 311, in _run_script exec(code, module.__dict__)
File "d:\work\python\streamlit\examples\bart_vs_bikes.py", line 42, in <module> bart_stop_stats = copy.deepcopy(from_data_file("bart_stop_stats.json"))
File "d:\programs\anaconda3\lib\site-packages\streamlit\caching.py", line 560, in wrapped_func return get_or_set_cache()
File "d:\programs\anaconda3\lib\site-packages\streamlit\caching.py", line 540, in get_or_set_cache return_value = func(*args, **kwargs)
File "d:\work\python\streamlit\examples\bart_vs_bikes.py", line 38, in from_data_file return pd.read_json(url)
File "d:\programs\anaconda3\lib\site-packages\pandas\io\json\json.py", line 408, in read_json path_or_buf, encoding=encoding, compression=compression,
File "d:\programs\anaconda3\lib\site-packages\pandas\io\common.py", line 195, in get_filepath_or_buffer req = _urlopen(filepath_or_buffer)
File "d:\programs\anaconda3\lib\urllib\request.py", line 222, in urlopen return opener.open(url, data, timeout)
File "d:\programs\anaconda3\lib\urllib\request.py", line 531, in open response = meth(req, response)
File "d:\programs\anaconda3\lib\urllib\request.py", line 641, in http_response 'http', request, response, code, msg, hdrs)
File "d:\programs\anaconda3\lib\urllib\request.py", line 569, in error return self._call_chain(*args)
File "d:\programs\anaconda3\lib\urllib\request.py", line 503, in _call_chain result = func(*args)
File "d:\programs\anaconda3\lib\urllib\request.py", line 649, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp)
Debug info
- Streamlit version: (get it with
$ streamlit version) 0.49.0 - Python version: (get it with
$ python --version) 3.7.0 - Using Conda? PipEnv? PyEnv? Pex? Conda
- OS version: Windows 10
- Browser version: Chrome Version 78.0.3904.70
Additional information
function from_data_file is using os.path.join in order to build url:
@st.cache
def from_data_file(filename):
dirname = "https://raw.githubusercontent.com/streamlit/streamlit/develop/examples/"
url = os.path.join(dirname, "data", filename)
return pd.read_json(url)
On Windows url has value(due to os.path.join()):
https://raw.githubusercontent.com/streamlit/streamlit/develop/examples/data\bart_stop_stats.json
instead of:
https://raw.githubusercontent.com/streamlit/streamlit/develop/examples/data/bart_stop_stats.json
Solution, consider to use posixpath.join() function
Metadata
Metadata
Assignees
Labels
type:bugSomething isn't working as expectedSomething isn't working as expected