NameError: name 'null' is not defined

Help to resolve this error .
happens while accessing streamlit using jupyter notebook

Hi @Avani, can you please share the code from your app (looks like it’s called test_file.py)?

Just based on the error, it appears that on line 5 you are using null, but in Python there is not a value called null – you probably are looking for None instead.

this is content of the test.py file

import streamlit as st

picture = st.camea_input(“Take a picture”)

if picture:
st.image(picture)

That is test_file.py? Because the error seems to be from test_file.py.

How exactly are you running the file? Are you using streamlit run test_file.py, or something else?

You mentioned jupyter notebooks, where do those come into play?

yes, that is the content of test_file.py.

i am using streamlit run test_file.py only.

i am using jupyter notebook for writing the Python code.

I am using this video as reference
[how to use streamlit with Jupyter ]
(https://www.youtube.com/watch?v=oKrqowyE8qY)

Can you do streamlit --version and share that?

And, is there a more complete error message in the console or in the jupyter notebook? I can’t see the whole error from your screenshot.

What happens if you run streamlit run test_app.py from a terminal, rather than running it from a jupyter notebook?




It looks like in your terminal you may be in the wrong folder. I can’t tell for sure, but your code might be located in the STREAMLIT folder. Try going into that folder in the terminal, and then doing streamlit run test_file.py
image


What I mean by that is cd STREAMLIT and THEN run streamlit run test_file.py

Excellent. OK, so that means that test_file.py doesn’t contain what you think it does. Can you run type test_file.py? I think it’s actually not a python file, but is a jupyter notebook with cells in it, so it’s not a valid streamlit app.

There might be a way to get it to work, but my recommendation would be to pick a text editor and use that to create and edit your .py files, and run them with the terminal, rather than running them from a jupyter notebook.

If you don’t have an editor handy, notepad++ is a nice and straightforward one, or vscode is a bit more powerful.

Hi Avani

Check for the correct method name st.camera_input.

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