# Error when running the python file

**URL:** <https://discuss.streamlit.io/t/error-when-running-the-python-file/20007>\
**Category:** Using Streamlit\
**Created:** [December 13, 2021, 7:34pm UTC](https://discuss.streamlit.io/t/error-when-running-the-python-file/20007 "2021-12-13T19:34:50Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![zalbich](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/zalbich/32/12265_2.png) [@zalbich](https://discuss.streamlit.io/u/zalbich)\
**Post date:** [December 13, 2021, 7:34pm UTC](https://discuss.streamlit.io/t/error-when-running-the-python-file/20007/1 "2021-12-13T19:34:50Z")

</div>

hi guys, anyone can help me with these errors?

```auto
  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(

```

---

<div class="post-metadata">

**Author:** ![zalbich](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/zalbich/32/12265_2.png) [@zalbich](https://discuss.streamlit.io/u/zalbich)\
**Post date:** [December 13, 2021, 7:36pm UTC](https://discuss.streamlit.io/t/error-when-running-the-python-file/20007/2 "2021-12-13T19:36:28Z")

</div>

my localhost become slower, cant rerun the localhost.

---

<div class="post-metadata">

**Author:** ![randyzwitch](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/randyzwitch/32/58772_2.png) [@randyzwitch](https://discuss.streamlit.io/u/randyzwitch)\
**Post date:** [December 13, 2021, 9:17pm UTC](https://discuss.streamlit.io/t/error-when-running-the-python-file/20007/3 "2021-12-13T21:17:11Z")

</div>

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 ☹

Best,  
Randy

---

<div class="post-metadata">

**Author:** ![zalbich](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/zalbich/32/12265_2.png) [@zalbich](https://discuss.streamlit.io/u/zalbich)\
**Post date:** [December 13, 2021, 11:57pm UTC](https://discuss.streamlit.io/t/error-when-running-the-python-file/20007/4 "2021-12-13T23:57:26Z")

</div>

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?

 ![image](https://global.discourse-cdn.com/streamlit/original/2X/b/b074042d48f171f105904cb28af8d21d8a470666.png)

---

<div class="post-metadata">

**Author:** ![zalbich](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/zalbich/32/12265_2.png) [@zalbich](https://discuss.streamlit.io/u/zalbich)\
**Post date:** [December 14, 2021, 12:00am UTC](https://discuss.streamlit.io/t/error-when-running-the-python-file/20007/5 "2021-12-14T00:00:19Z")

</div>

![image](https://global.discourse-cdn.com/streamlit/original/2X/b/b91070f2dac613421ca78a0de7a45c45d17c73ab.png)

---

<div class="post-metadata">

**Author:** ![MatG](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/matg/32/12119_2.png) [@MatG](https://discuss.streamlit.io/u/MatG)\
**Post date:** [January 4, 2022, 3:04pm UTC](https://discuss.streamlit.io/t/error-when-running-the-python-file/20007/6 "2022-01-04T15:04:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Noman](https://avatars.discourse-cdn.com/v4/letter/n/d6d6ee/32.png) [@Noman](https://discuss.streamlit.io/u/Noman)\
**Post date:** [August 3, 2022, 5:42am UTC](https://discuss.streamlit.io/t/error-when-running-the-python-file/20007/7 "2022-08-03T05:42:32Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![Hamza\_Essakhi](https://avatars.discourse-cdn.com/v4/letter/h/c0e974/32.png) [@Hamza\_Essakhi](https://discuss.streamlit.io/u/Hamza_Essakhi)\
**Post date:** [November 9, 2022, 12:26pm UTC](https://discuss.streamlit.io/t/error-when-running-the-python-file/20007/8 "2022-11-09T12:26:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![riya\_singh](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/riya_singh/32/20044_2.png) [@riya\_singh](https://discuss.streamlit.io/u/riya_singh)\
**Post date:** [November 12, 2022, 7:58am UTC](https://discuss.streamlit.io/t/error-when-running-the-python-file/20007/9 "2022-11-12T07:58:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Vikas\_Reddy\_Ravulapa](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/vikas_reddy_ravulapa/32/20475_2.png) [@Vikas\_Reddy\_Ravulapa](https://discuss.streamlit.io/u/Vikas_Reddy_Ravulapa)\
**Post date:** [November 28, 2022, 6:24pm UTC](https://discuss.streamlit.io/t/error-when-running-the-python-file/20007/10 "2022-11-28T18:24:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/streamlit/original/3X/c/f/cf4c2ee0d938358f82448c5fe4b9c3c91d7ce19c.svg) [@system](https://discuss.streamlit.io/u/system)\
**Post date:** [November 28, 2023, 6:24pm UTC](https://discuss.streamlit.io/t/error-when-running-the-python-file/20007/11 "2023-11-28T18:24:30Z")

</div>

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