Skip to content

Instantly share code, notes, and snippets.

@zazazack
Forked from omz/FileBrowser.py
Last active November 1, 2016 15:33
Show Gist options
  • Save zazazack/3fca5cad2cd0b5238ecf41e3c0136c99 to your computer and use it in GitHub Desktop.
Save zazazack/3fca5cad2cd0b5238ecf41e3c0136c99 to your computer and use it in GitHub Desktop.
FileBrowser
import http.server
import socketserver
import webbrowser
import os
os.chdir('/')
Handler = http.server.SimpleHTTPRequestHandler
httpd = socketserver.TCPServer(("", 0), Handler)
port = httpd.server_address[1]
webbrowser.open('http://localhost:' + str(port))
httpd.serve_forever()
import SimpleHTTPServer
import SocketServer
import webbrowser
import os
os.chdir('/')
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", 0), Handler)
port = httpd.server_address[1]
webbrowser.open('http://localhost:' + str(port), stop_when_done=True)
httpd.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment