Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
Apple Computing Products:
macOS - Operating System
is there anyway I can edit a file that I dont have permission for?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="vansmith" data-source="post: 1152432" data-attributes="member: 71075"><p>Just a tip - you shouldn't be using Python's SimpleHTTPServer for anything serious (I'm not saying you are though).</p><p></p><p>A much easier solution would be to simply write a small server in Python using SimpleHTTPServer and run that from a directory that you have permissions to. Using <a href="http://docs.python.org/library/simplehttpserver.html" target="_blank">Python's docs</a> to help me here (I'm largely unfamiliar with the SImpleHTTPServer module), create a file called <something>.py (replace <something> with whatever you want) and make the contents of the file the following:[code]import SimpleHTTPServer</p><p>import SocketServer</p><p></p><p>PORT = 8000</p><p></p><p>Handler = SimpleHTTPServer.SimpleHTTPRequestHandler</p><p></p><p>httpd = SocketServer.TCPServer(("", PORT), Handler)</p><p></p><p>print "serving at port", PORT</p><p>httpd.serve_forever()[/code]Execute that by executing[code]python <something>.py[/code]Put your html docs in the directory with the Python script and navigate to <a href="http://localhost:8000" target="_blank">http://localhost:8000</a> (change the port if you change it in the script).</p></blockquote><p></p>
[QUOTE="vansmith, post: 1152432, member: 71075"] Just a tip - you shouldn't be using Python's SimpleHTTPServer for anything serious (I'm not saying you are though). A much easier solution would be to simply write a small server in Python using SimpleHTTPServer and run that from a directory that you have permissions to. Using [URL="http://docs.python.org/library/simplehttpserver.html"]Python's docs[/URL] to help me here (I'm largely unfamiliar with the SImpleHTTPServer module), create a file called <something>.py (replace <something> with whatever you want) and make the contents of the file the following:[code]import SimpleHTTPServer import SocketServer PORT = 8000 Handler = SimpleHTTPServer.SimpleHTTPRequestHandler httpd = SocketServer.TCPServer(("", PORT), Handler) print "serving at port", PORT httpd.serve_forever()[/code]Execute that by executing[code]python <something>.py[/code]Put your html docs in the directory with the Python script and navigate to [url]http://localhost:8000[/url] (change the port if you change it in the script). [/QUOTE]
Verification
Post reply
Forums
Apple Computing Products:
macOS - Operating System
is there anyway I can edit a file that I dont have permission for?
Top