Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Run the Python program in the background under Windows

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

[code]

# encoding: utf-8#author: walker#date: 2019-05-24#summary: simple http server for testing background running import http.serverimport socketserverPORT = 5678Handler = http.server.SimpleHTTPRequestHandlerwith socketserver.TCPServer ((",", PORT), Handler) as httpd: print ("serving at port% d"% PORT, flush=True) httpd.serve_forever ()

[mode of operation]

"C:\ Program Files\ Python36\ pythonw.exe" daemon.py# OR "C:\ Program Files\ Python36\ pythonw.exe" daemon.py > log.txt 2 > & "OR" C:\ Program Files\ Python36\ pythonw.exe "daemon.py 1 > stdout.txt 2 > stderr.txt

[packing method]

Pyinstaller-w-- onefile daemon.py

[related reading]

Http.server-HTTP servers

Pythonw.exe or python.exe?

* walker * *

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report