New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

is there anyway I can edit a file that I dont have permission for?


Post Reply New Thread Subscribe

 
Thread Tools
Ghetto Cowboy

 
Member Since: Dec 10, 2010
Posts: 1
Ghetto Cowboy is on a distinguished road

Ghetto Cowboy is offline
Hi, ive been messing around with terminal and I saw this code that can set up a very simple server on your 8080 port

python -m SimpleHTTPServer 8080

And it works great and ive had fun messing around with it, but when i put an html file named index.htm or named anything else, the html code isn't translated into the page, it justs displays the code

i've navigated to the file

/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SimpleHTTPServer.py

and found that when I edit it, i can edit the html file that is the root directory when you start that server, the only thing is that I can't save the file as i dont have permission. Anyone have any tips?
QUOTE Thanks
Dalton63841

 
Member Since: Dec 04, 2010
Posts: 6
Dalton63841 is on a distinguished road

Dalton63841 is offline
Edit the file however you need to. Save it to your desktop. Then copy the saved file to the originals location in Finder. In the dialogs that pop up click Replace, and put in your password.
QUOTE Thanks
DarkestRitual

 
Member Since: Apr 09, 2009
Location: Ithaca NY
Posts: 2,073
DarkestRitual is just really niceDarkestRitual is just really niceDarkestRitual is just really niceDarkestRitual is just really nice
Mac Specs: 13 inch alMacBook 2GHz C2D 4G DDR3, 1.25GHz G4 eMac

DarkestRitual is offline
or sudo chmod 777 /file/path/here
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,682
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is online now
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 Python's docs 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()
Execute that by executing
Code:
python <something>.py
Put your html docs in the directory with the Python script and navigate to http://localhost:8000 (change the port if you change it in the script).

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Personal Twitter
QUOTE Thanks

Post Reply New Thread Subscribe


« Cannot load certain websites in Firefox | Mac air... internet Slows down after a while please help »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
My MacBook Pro and creating an archive (zip) file Lsrichards Apple Notebooks 7 02-10-2011 04:49 AM
how do you edit file properties in snow leopard converted OS X - Operating System 6 09-05-2010 08:59 AM
InDesign won't let me edit original file groutster OS X - Apps and Games 0 03-05-2010 12:54 PM
How Can You Edit "Get Info" Of a File? MacUser_88905 OS X - Operating System 8 07-26-2009 01:19 AM
How best can I Edit this file??? topdog99 Music, Audio, and Podcasting 6 05-07-2008 02:01 PM

All times are GMT -4. The time now is 03:31 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?