Trying to run a python script using streamlit

I am new to streamlit and just trying to open a basic python script for the first time. I am using the anaconda command prompt and I have already installed streamlit.
Here is how I am running the program:
e

and here is the message I get when my web browser tries to open the file:

What am I doing wrong!?

Thank you!

Hi @adfry!

Seems that there is an HTML doctype tag on line 7 → <!DOCTYPE html>.

HTML tags are not valid Python syntax, and hense a SyntaxError is raised during code execution. Perhaps you copy pasted this code from somewhere? If you wish to execute raw HTML code you can use components.html.

import streamlit.components.v1 as components

components.html("<h1>HTML can be put herr</h1>")

Could you share your code? This way I can check if there is more invalid syntac.

Ahhh, you’re right… I was copying the code from somewhere incorrectly and so it was registering it as HTML instead of Python… thank you! Simple as hell mistake!

1 Like