Error when running the python file

hi guys, anyone can help me with these errors?

  A new version of Streamlit is available.

  See what's new at https://discuss.streamlit.io/c/announcements

  Enter the following command to upgrade:
  $ pip install streamlit --upgrade


  You can now view your Streamlit app in your browser.

  Local URL: http://localhost:8501
  Network URL: http://192.168.100.168:8501

2021-12-14 02:31:00.907 Uncaught exception GET /stream (::1)
HTTPServerRequest(protocol='http', host='localhost:8501', method='GET', uri='/stream', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\tornado\web.py", line 1704, in _execute
    result = await result
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\tornado\websocket.py", line 278, in get
    await self.ws_connection.accept_connection(self)
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\tornado\websocket.py", line 879, in accep
t_connection
    await self._accept_connection(handler)
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\tornado\websocket.py", line 962, in _acce
pt_connection
    await self._receive_frame_loop()
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\tornado\websocket.py", line 1116, in _rec
eive_frame_loop
    await self._receive_frame()
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\tornado\websocket.py", line 1205, in _rec
eive_frame
    handled_future = self._handle_message(opcode, data)
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\tornado\websocket.py", line 1217, in _han
dle_message
    data = self._decompressor.decompress(data)
  File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\tornado\websocket.py", line 798, in decom
press
    result = decompressor.decompress(
TypeError: 'float' object cannot be interpreted as an integer
C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\altair\utils\core.py:185: UserWarning: I don't kn
ow how to infer vegalite type from 'empty'.  Defaulting to nominal.
  warnings.warn(

my localhost become slower, cant rerun the localhost.

Hi @zalbich, welcome to the Streamlit community!

Can you post a snippet of code that demonstrates this behavior, either pasting here or linking to GitHub. The error message of TypeError: 'float' object cannot be interpreted as an integer is unfortunately not very descriptive by Python :frowning:

Best,
Randy

Hi @randyzwitch , thank you for replying.
But i think its not the code problems, i dont know why my localhost became slower from the first and i cant even rerun that. Any solution?

1 Like

I had a similar error. The problem it turned out was that one function of my script changes the working directory (CWD) and it’s not rest back to the streamlit app dir. The error was fixed when I changed the cwd back after the said function has returned. Hope this helps you.

I have the same problem. I can run the code using the following command:
streamlit run “Test2.py”

The code is as follows:
import streamlit
streamlit.title(“Test”)

The streamlit window opens in my browser, but then I immediately get the following error message:

You can now view your Streamlit app in your browser.

  • Local URL: …*
  • Network URL: …*

2022-08-03 07:03:31.103 Uncaught exception GET /stream (::1)
HTTPServerRequest(protocol=‘http’, host=‘localhost:8504’, method=‘GET’, uri=‘/stream’, version=‘HTTP/1.1’, remote_ip=‘::1’)
Traceback (most recent call last):

  • File “C:\Users\user-id\AppData\Roaming\Python\Python310\site-packages\tornado\web.py”, line 1713, in _execute*
  • result = await result*
  • File “C:\Users\user-id\AppData\Roaming\Python\Python310\site-packages\tornado\websocket.py”, line 277, in get*
  • await self.ws_connection.accept_connection(self)*
  • File “C:\Users\user-id\AppData\Roaming\Python\Python310\site-packages\tornado\websocket.py”, line 867, in accept_connection*
  • await self._accept_connection(handler)*
  • File “C:\Users\user-id\AppData\Roaming\Python\Python310\site-packages\tornado\websocket.py”, line 950, in _accept_connection*
  • await self._receive_frame_loop()*
  • File “C:\Users\user-id\AppData\Roaming\Python\Python310\site-packages\tornado\websocket.py”, line 1106, in _receive_frame_loop*
  • await self._receive_frame()*
  • File “C:\Users\user-id\AppData\Roaming\Python\Python310\site-packages\tornado\websocket.py”, line 1195, in _receive_frame*
  • handled_future = self._handle_message(opcode, data)*
  • File “C:\Users\user-id\AppData\Roaming\Python\Python310\site-packages\tornado\websocket.py”, line 1207, in _handle_message*
  • data = self._decompressor.decompress(data)*
  • File “C:\Users\user-id\AppData\Roaming\Python\Python310\site-packages\tornado\websocket.py”, line 786, in decompress*
  • result = decompressor.decompress(*
    TypeError: ‘float’ object cannot be interpreted as an integer

Does anyone have an idea how to solve this? @MatG: Could you explain how you changed the cwd within the Python code? My apologies, I am rather new to programming & Python and do not know how exactly I can reset the directory within my two-line code…

I Have the same error , could you tell me the solution if you solved it ?

Hey i get tha same error. How you slove it plz help

Just reinstall the streamlit and that should work​:+1::+1::+1:

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.