のうち、シェルスクリプトを実行する方法。私はシェルファイルを実行しようとしています。 私はシェルファイルを実行可能にすることはできません。ウィンドウ内のchmod + x filename.shのようなsoemthingを探します。Windowsの場合:</p> <pre><code>python -m http.server --cgi 8000 </code></pre> <p>Serverが稼働していると私はそれにPythonスクリプトを実行することができていますhttp.server使用Srver私のpythonをしたシンプルなCGIパイソンサーバ
Ubuntuの等価リンク:
Content-type text/htmlException happened during processing of request from ('127.0.0.1', 1659)
Traceback (most recent call last):
File "C:\Users\ABC\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py", line 313, in _handle_request_noblock
self.process_request(request, client_address)
File "C:\Users\ABC\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py", line 341, in process_request
self.finish_request(request, client_address)
File "C:\Users\ABC\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py", line 354, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Users\ABC\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py", line 681, in __init__
self.handle()
File "C:\Users\ABC\AppData\Local\Programs\Python\Python35-32\lib\http\server.py", line 422, in handle
self.handle_one_request()
File "C:\Users\ABC\AppData\Local\Programs\Python\Python35-32\lib\http\server.py", line 410, in handle_one_request
method()
File "C:\Users\ABC\AppData\Local\Programs\Python\Python35-32\lib\http\server.py", line 645, in do_GET
f = self.send_head()
File "C:\Users\ABC\AppData\Local\Programs\Python\Python35-32\lib\http\server.py", line 953, in send_head
return self.run_cgi()
File "C:\Users\ABC\AppData\Local\Programs\Python\Python35-32\lib\http\server.py", line 1161, in run_cgi
env = env
File "C:\Users\ABC\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "C:\Users\ABC\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1224, in _execute_child
startupinfo)
OSError: [WinError 193] %1 is not a valid Win32 application
<h1>Hello World</h1>
コンテンツPythonのファイルの更新:
#!/usr/bin/env python
print("Content-type text/html")
print("")
print("<h1> Hello World </h1 >")`
は現在、私はこのエラーを取得しています
出力:(ブラウザ画面上)
Hello World
シェルファイルの内容
#!/bin/bash
echo "Content-type text/html"
echo ""
echo "<h1>Hello World</h1>" `
出力:前述のエラー上記 。
同様の出力をしたいHello World。
HTMLコードをプログラムとして実行しようとしました。だから失敗しても何を期待していますか? – Daniel
は質問を更新しました:予想された現在の出力は何ですか? – wadhwa94