buenavista62 / kickbased

1 stars 0 forks source link

cannot import name 'show_pages_from_config' #2

Open Shazgul opened 2 months ago

Shazgul commented 2 months ago

D:\Kickbase\kickbased-main>python app.py Traceback (most recent call last): File "D:\Kickbase\kickbased-main\app.py", line 5, in <module> from st_pages import hide_pages, show_pages_from_config ImportError: cannot import name 'show_pages_from_config' from 'st_pages' (C:\Users\USERNAME\AppData\Local\Programs\Python\Python312\Lib\site-packages\st_pages\__init__.py). Did you mean: '_get_pages_from_config'?

Shazgul commented 2 months ago

Changed 'show_pages_from_config' to '_get_pages_from_config' in App.py, run with Streamlit again, now it shows in Browser after Login:

"Failed to load player data: 'Kickbase' object has no attribute 'get_all_players'"

File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python312\Lib\site-packages\streamlit\runtime\scriptrunner\exec_code.py", line 75, in exec_func_with_error_handling
    result = func()
             ^^^^^^
File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python312\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 574, in code_to_exec
    exec(code, module.__dict__)
File "D:\Kickbase\kickbased-main\app.py", line 219, in <module>
    main()
File "D:\Kickbase\kickbased-main\app.py", line 158, in main
    prepare_and_load_data()
File "D:\Kickbase\kickbased-main\app.py", line 194, in prepare_and_load_data
    load_and_prepare_kickbase_data()
File "D:\Kickbase\kickbased-main\app.py", line 203, in load_and_prepare_kickbase_data
    prepare_data()  # Adjusted to call the new data preparation function
    ^^^^^^^^^^^^^^
File "D:\Kickbase\kickbased-main\app.py", line 93, in prepare_data
    merge_with_kickbase_data(df_li)
File "D:\Kickbase\kickbased-main\app.py", line 107, in merge_with_kickbase_data
    ss.kb_data_merged = fn.mergeKB(df_li, ss.kb_data)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Kickbase\kickbased-main\functions.py", line 25, in mergeKB
    df = df_li.merge(df_kb, how="inner", on=["ID"])
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python312\Lib\site-packages\pandas\core\frame.py", line 10832, in merge
    return merge(
           ^^^^^^
File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python312\Lib\site-packages\pandas\core\reshape\merge.py", line 153, in merge
    right_df = _validate_operand(right)
               ^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python312\Lib\site-packages\pandas\core\reshape\merge.py", line 2692, in _validate_operand
    raise TypeError(
buenavista62 commented 2 months ago

There seems to be an issue with the st_pages module. Which streamlit version are you using?

A possible solution would be to use the latest streamlit version and update the code accordingly (newer streamlit versions support st.Page natively)