Python Forum
python -m http.server giving invalid syntax
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python -m http.server giving invalid syntax
#1
This should say it all: ─░mage


According to all the X3DOM literature this should be a simple do.

Python was installed successfully in my 'site' directory which also holds my index.html file.

Caveat: I do not wish to become a server SW engineer, I just wanna use X3D's <inline> function.
Reply
#2
Your image isn't working. Can you just copy/paste whatever's in the terminal?
Reply
#3
Python 2 or Python 3?
Which version do you have installed?

For Python 2 the module is called SimpleHTTPServer. So it is going to be:
python -m SimpleHTTPServer
Python 3:
python3 -m http.server
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#4
Thanks for the reply.

My V is 3.6.5 and either way (python or python3) the return is:

file "<stdin>", line 1
python3 -m http.server 8000
(up caret under the 'p') ((Alt 94 doesn't work?)
SyntaxError: invalid syntax

I tried
import http.server
and it ran OK seemingly.
help(hhtp.server)
ran OK too (hard to get out of tho).

I don't know . . .
Reply
#5
(May-15-2018, 09:44 PM)echowit Wrote: file "<stdin>", line 1
python3 -m http.server 8000
(up caret under the 'p') ((Alt 94 doesn't work?)
SyntaxError: invalid syntax


python [...etc] should be run from the command line/terminal, not from an interactive python session.
Reply
#6
D'oh! Been too many years since my command line days. Gotta crawl back out of that Window.

'preciate the prompt reply, Localhost is playimg nice and the X3D <inline> link is working great.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  http server whit proxy jrcruz 0 902 Feb-13-2019, 10:02 AM
Last Post: jrcruz
  Add password to HTTP.server edgarfinchley 1 4,325 Aug-09-2018, 03:17 PM
Last Post: nilamo
  Python 2 http networking problems, if any Aeneas 1 1,548 Sep-06-2017, 07:24 PM
Last Post: wavic
  newbie here - need help with building very basic http server BenSalem 0 1,184 Aug-14-2017, 08:06 AM
Last Post: BenSalem

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020