App loading problem

hi… I tried to run the uber.py app,which is there in the instruction on streamlit.io but every time I run the app through the command prompt it gives me this error :

NameError : name ‘null’ is not defined

File “c:\users\rashi\anaconda3\lib\site-packages\streamlit\ScriptRunner.py”, line 306, in _run_script exec(code, module.dict)

File “C:\Users\rashi\uber.py”, line 5, in “execution_count”: null,

Im using stream lit version:0.47.2 and I tried using the latest version as well 0.47.3

python version: 3.7.3

can someone helo me with this problem?

Hi adeell

I’m having trouble reproducing your bug on my machine. So I dug around the codebase for both Streamlit and the Uber demo, and couldn’t find anything about execution_count. After a Google search it seems that execution_count is a variable that Jupyter keeps for each of its cells.

Which makes me wonder: can you explain in a little more detail what your setup looks like? How are you running the Uber app? Are you running Streamlit from inside Jupyter somehow?

hi Thiago

thanks for the reply
well after writing the code I downloaded the file as a .py file on my desktop and ran “Streamlit run uber.py” in my terminal after which I get the following feedback "

You can now view your Streamlit app in your browser.

Local URL: http ://localhost:8501

but when it opens I get the execution_count errors, I tried running it without downloading directly from Jupiter but the same error occurred

Hi @adeell: Can you please share the exact error message you’re seeing, including the full stack trace?

Also, on the off-chance that this might tell us something, can you please make sure that Jupyter isn’t running when you streamlit run uber.py from the command line?

hey @Adrien_Treuille
thanks for the reply
the issue got fixed once I uninstalled and then reinstalled Streamlit…there seems to be no more issues

1 Like

Hello,I have the same problem!
O the command line:
Last login: Mon Nov 4 13:03:18 on ttys001

(base) MacBookProdeMacBook-Pro:~ macbookpro$ streamlit run st.ipynb

You can now view your Streamlit app in your browser.

Local URL: http://localhost:8501

Network URL: http://192.168.1.100:8501
On the localhost
NameError : name ‘null’ is not defined

File “/Users/macbookpro/anaconda3/lib/python3.6/site-packages/streamlit/ScriptRunner.py”, line 311, in _run_script exec(code, module.dict)

File “/Users/macbookpro/st.ipynb”, line 28, in “execution_count”: null,

Hi @ZoranDai – and welcome to the forum :wave:

Streamlit is meant to be run directly against python scripts, not Jupyter notebook files.

Could you try running the following and if you’re still having issues, let us know.

streamlit run https://raw.githubusercontent.com/streamlit/demo-uber-nyc-pickups/master/app.py

Thanks!

1 Like

I’ve also added a feature request so that future users are less likely to encounter this failure mode in the future. :heart:

Hi! I have the same problem running the app in my browser, I’ve reinstalled streamlit but the error keeps occurring, could anyone help me please?

NameError: name ‘null’ is not defined

Traceback:

File "/Users/santiago/opt/anaconda3/lib/python3.7/site-packages/streamlit/ScriptRunner.py", line 322, in _run_script
    exec(code, module.__dict__)File "/Users/santiago/iris-ml-app.py", line 61, in <module>
    "execution_count": null,

Hi @vdl and welcome to the forums! Can you please help us understand what happened. Did you try running:

streamlit run iris-ml-app.py

from the command line?

Right, that’s when the tab with the message I posted appears in my browser

I also get the same error…

NameError: name ‘null’ is not defined
Traceback:

File "/opt/oss/conda3/lib/python3.7/site-packages/streamlit/ScriptRunner.py", line 322, in _run_script
    exec(code, module.__dict__)
File "/home/<username>/streamlib_test.py", line 5, in <module>
    "execution_count": null,

I got the Streamlit demo to work in our virtual environment, but when I try to run a simple “Hello World” .py I get the exact same error. Here’s my py code:

import streamlit as st
st.write("Hello world")

But it looks like Streamlit creates a JSON version of my code, which is where I can see where “null” is, though I can’t explain it…

{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import streamlit as st\n",
    "st.write('Hello world')"
   ]
  },

As you can see on Line 5, Streamlit appears to create a null value, that it errors on. Hope this helps.

Hello World here needs to be quoted to make it a valid Python string.

import streamlit as st
st.write("Hello, World")

Yep - that’s what I originally had. Got a little desperate and removed quotes that last time, but yes. I ran it as st.write("Hello world") I’ll edit previous post to reflect that. Thanks
I guess the point is, I’ve seen several other people (as above) that are having the same experience. We’re “close” to getting it working - just not there yet.

Based on the “cells” part of the JSON, are you running this from Jupyter? If so, you should be running the demo from a Python script and streamlit run app.py from the command line.

Yes, running it from terminal. We set the server name, so it’s visible from all our VM environments. Which worked on the streamlit demo just fine - so we know that should not be the problem.

$ streamlit run streamlib_test.py --server.address 0.0.0.0

I guess I’m confused…where did this JSON come from?

{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import streamlit as st\n",
    "st.write('Hello world')"
   ]
  },

Good question. I assume streamlit converted it to JSON for processing. But it’s no coincidence that “Line 5” in the JSON format contains the null statement that several other people also receive this error about.

Can you send me the exact file you are using?

Wow… I couldn’t send my .PY file because it had gotten changed to that JSON format. So I recreated the 2 line file and now it ran fine! Puzzling. The only difference is the original file (that got converted to JSON) was at the root directory of our VM environment… This time I created it within my folder and no problems. The .PY file didn’t get converted to JSON. I can’t explain it, but it’s working now. Thanks for challenging me here a bit - cause it helped me get it working. Thanks!