Python Forum
python -m http.server giving invalid syntax - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Networking (https://python-forum.io/forum-12.html)
+--- Thread: python -m http.server giving invalid syntax (/thread-10157.html)



python -m http.server giving invalid syntax - echowit - May-15-2018

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.


RE: python -m http.server giving invalid syntax - nilamo - May-15-2018

Your image isn't working. Can you just copy/paste whatever's in the terminal?


RE: python -m http.server giving invalid syntax - wavic - May-15-2018

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



RE: python -m http.server giving invalid syntax - echowit - May-15-2018

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 . . .


RE: python -m http.server giving invalid syntax - nilamo - May-15-2018

(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.


RE: python -m http.server giving invalid syntax - echowit - May-17-2018

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.