The last line comes directly from the latest Python docs on http.server, but the shell says "Syntax Error."
Then I tried :
python3 -m http.server 8000 --bind 127.0.0.1
But the shell still says "Syntax Error."
Then I tried the simplest command:
python -m http.server also says "Syntax Error":
But the shell still says "Syntax Error."
What am I doing wrong?
Thanks for any help.
Answer
Because you're having trouble understanding what we mean in the comments; you need to run the command
python -m http.server 8000 --bind 127.0.0.1
from a bash (or similar) shell, NOT from the python IDLE interpreter. They do not mean the same thing. You would have to type the command python into your shell in order to get to you Python IDLE interpreter.
If you're in your python interpreter and would like to exit, press Ctrl+D to return to your bash (or similar) shell. Then, execute the command
python -m http.server 8000 --bind 127.0.0.1
and it should work.
You are right that the python documentation for httpserver could be made more clear but you should know that when you see a call to python it's almost certainly being made from a shell.
Closed. This question needs debugging details. It is not currently accepting answers.Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to repro…
I am assigning some variables to values from a data frame.
The data frame created using this code
data = [[tom, 10], ["", 15], [juli, 14]]
df = pd.DataFrame(data, columns=[Name, Age])So after…
I am reading every row in a dataframe and assigning its values in each column to the variables
The dataframe created using this code
data = [[tom, 10], [, 15], [juli, 14]]
df = pd.DataFrame(data, colum…
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.This question was caused by a typo or a problem that can no longer be reproduced. While similar q…
I am trying this sample code that I found which is really really good. I am also trying to figure out the same thing to find an item and scroll to it, but this time I wanted to match the the string whi…
My main list has 44 names as elements. I want to rearrange them in a specific order. I am giving here an example. Note that elements in my actual list are some technical names. No way related to what I…
Can i get source code to get reviews using gmb python code also heard mybusiness is discontinued.
I tried using my business api is discontinued can i get the implementation process to look for extract…
Im trying to get the words(users) from a text file hosted online, such as from www.site.com/mytextfile.txt or pastebin.com/raw/1111111.
I will have multiple "users", one in each line.
My code…
I am reading a file and calculating the frequency of the top 100 words. I am able to find that and create the following list:[(test, 510), (Hey, 362), ("please", 753), (take, 446), (herbert, …