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

Unable to create Pandas Series in cached functions #115

Closed
j4th opened this issue Sep 16, 2019 · 1 comment · Fixed by #117
Closed

Unable to create Pandas Series in cached functions #115

j4th opened this issue Sep 16, 2019 · 1 comment · Fixed by #117
Assignees
Labels
feature:cache Related to st.cache_data and st.cache_resource type:bug Something isn't working

Comments

@j4th
Copy link

j4th commented Sep 16, 2019

Summary

Unable to generate Pandas Series in cached functions.

Steps to reproduce

Run this code:

import streamlit as st 
import pandas as pd

@st.cache
def test_function():
    series = pd.Series()
    return series

test_function()

Expected behavior:

Expect to be able to create Pandas Series inside of cached functions.

Actual behavior:

Following error is thrown:

TypeError: stat: path should be string, bytes, os.PathLike or integer, not property
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/ScriptRunner.py", line 317, in _run_script exec(code, module.__dict__)
File "/home/jforth/Documents/streamlit_test.py", line 9, in <module> test_function()
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/caching.py", line 393, in wrapped_func code_hasher.update(func)
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/hashing.py", line 159, in update self._update(self.hasher, obj, context)
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/hashing.py", line 190, in _update b = self.to_bytes(obj, context)
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/hashing.py", line 179, in to_bytes b = self._to_bytes(obj, context)
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/hashing.py", line 259, in _to_bytes h.update(self._code_to_bytes(obj.__code__, context))
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/hashing.py", line 316, in _code_to_bytes self._update(h, ref, context)
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/hashing.py", line 190, in _update b = self.to_bytes(obj, context)
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/hashing.py", line 179, in to_bytes b = self._to_bytes(obj, context)
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/site-packages/streamlit/hashing.py", line 236, in _to_bytes isinstance(obj, io.IOBase) or os.path.exists(obj.name)):
File "/home/jforth/anaconda3/envs/AutoDraft/lib/python3.7/genericpath.py", line 19, in exists os.stat(path)

Is this a regression?

Not sure.

Debug info

  • Streamlit version: 0.45.0
  • Python version: 3.7.4
  • Using Conda
  • OS version: Ubuntu 19.04
  • Browser version: Chrome 77.0.3865.75
@j4th j4th added the type:bug Something isn't working label Sep 16, 2019
@domoritz domoritz self-assigned this Sep 16, 2019
@domoritz
Copy link
Contributor

Fixed in #117.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:cache Related to st.cache_data and st.cache_resource type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants