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

import problem #9

Open
Sheikh-Hamoodi opened this issue Sep 5, 2023 · 5 comments
Open

import problem #9

Sheikh-Hamoodi opened this issue Sep 5, 2023 · 5 comments
Assignees

Comments

@Sheikh-Hamoodi
Copy link

Sheikh-Hamoodi commented Sep 5, 2023

Getting this issue while trying to import:
from streamlit_gsheets.gsheets_connection import GSheetsConnection # noqa ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\123\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit_gsheets\gsheets_connection.py", line 39, in <module> from validators.utils import ValidationFailure ImportError: cannot import name 'ValidationFailure' from 'validators.utils'
all the same code:
import streamlit as st import streamlit_gsheets from streamlit_gsheets import GSheetsConnection

url = "https://docs.google.com/spreadsheets/d/1JDy9md2VZPz4JbYtRPJLs81_3jUK47nx6GYQjgU8qNY/edit?usp=sharing"

conn = st.experimental_connection("gsheets", type=GSheetsConnection)

data = conn.read(spreadsheet=url, usecols=[0, 1])
st.dataframe(data)
`

@ShruAgarwal
Copy link

ShruAgarwal commented Sep 7, 2023

Thanks, @Sheikh-Hamoodi for pointing this out! 🙂

I'm facing the same error when trying to connect Google Sheets in both ways, i.e., via public URL and private account 👇
public_gsheets_error

Please guide us on this, @sfc-gh-jcarroll 🙏

@sfc-gh-jcarroll
Copy link
Contributor

It looks like a breaking change in a recent version 0.21.2 of validators python-validators/validators#283 (see also python-validators/validators#291)

Should be able to work around if you pin validators to an earlier version like 0.21.0

@sfc-gh-tszerszen would you be able to make a fix when you get a chance? I'm happy to review. If we want to just update the minimum version of validators and make the change to new error, that's fine with me.

@ShruAgarwal
Copy link

Thanks a lot for the suggestion @sfc-gh-jcarroll 🤗
I pinned validators==0.21.1 and it works great!

@im-sanka
Copy link

Hey, I tried to pin the validators but still it gave me the error.
I tried 0.21.1 and 0.21.0

The error says:
TypeError: ValidationFailure.__init__() got an unexpected keyword argument 'args' Traceback: File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script exec(code, module.__dict__) File "/Users/is/Desktop/Medium/data-prep/eu.py", line 51, in <module> email, database = create_database() File "/Users/is/Desktop/Medium/data-prep/ue.py", line 10, in create_database database = conn.read( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/streamlit_gsheets/gsheets_connection.py", line 570, in read return self.client.read( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/streamlit_gsheets/gsheets_connection.py", line 423, in read url = self._get_download_as_csv_url( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/streamlit_gsheets/gsheets_connection.py", line 370, in _get_download_as_csv_url validation_failure = ValidationFailure(

Any suggestion? @sfc-gh-jcarroll

@sfc-gh-tszerszen
Copy link
Collaborator

@Sheikh-Hamoodi @ShruAgarwal @im-sanka @sfc-gh-jcarroll thank you for taking a look and this feedback I'll take a look, probably during next weekend and will get back to you

@sfc-gh-tszerszen sfc-gh-tszerszen self-assigned this Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants