caosz
caosz

Reputation: 47

ValueError: invalid literal for int() with base 10: '--cgi' when using python3 -m http.server --cgi 8000

When i run python3 -m http.server --cgi 8000 It says:

Traceback (most recent call last):
  File "/usr/lib/python3.2/runpy.py", line 160, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python3.2/runpy.py", line 73, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.2/http/server.py", line 1187, in <module>
    test(HandlerClass=SimpleHTTPRequestHandler)
  File "/usr/lib/python3.2/http/server.py", line 1169, in test
    port = int(sys.argv[1])
ValueError: invalid literal for int() with base 10: '--cgi'

Upvotes: 0

Views: 316

Answers (1)

Hesky Fisher
Hesky Fisher

Reputation: 1365

It looks like the --cgi flag was only added in python 3.3. You're using python 3.2, which expects the only argument to be a port number.

The fix seems to be to upgrade to python 3.3 or not use --cgi.

Upvotes: 1

Related Questions