astropy/astropy — pull request #867 by iguananaut (2013-03-28 22:24:35+00:00)
Title: pip install problem - owner of .astropy is root

I installed astropy with pip:
``` sudo pip install astropy```
which seemed ok.

but when importing astropy:
```
In [1]: import astropy
/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/astropy/logger.py:524: RuntimeWarning: log file u'/Users/destry/.astropy/config/astropy.log' could not be opened for writing: [Errno 13] Permission denied: u'/Users/destry/.astropy/config/astropy.log'
'{1}'.format(log_file_path, unicode(e)), RuntimeWarning)
Custom TB Handler failed, unregistering
---------------------------------------------------------------------------
SystemError Traceback (most recent call last)
/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/astropy/logger.pyc in ipy_exc_handler(ipyshell, etype, evalue, tb, tb_offset)
304 def ipy_exc_handler(ipyshell, etype, evalue, tb, tb_offset=None):
305 # First use our excepthook

--> 306 self._excepthook(etype, evalue, tb)
307
308 # Now also do IPython's traceback

/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/astropy/logger.pyc in _excepthook(self, etype, value, traceback)
252
253 if mod is not None:
--> 254 self.error(message, extra={'origin': mod.__name__})
255 else:
256 self.error(message)

/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/logging/__init__.pyc in error(self, msg, *args, **kwargs)
1156 """
1157 if self.isEnabledFor(ERROR):
-> 1158 self._log(ERROR, msg, args, **kwargs)
1159
1160 def exception(self, msg, *args):

/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/logging/__init__.pyc in _log(self, level, msg, args, exc_info, extra)
1248 exc_info = sys.exc_info()
1249 record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra)
-> 1250 self.handle(record)
1251
1252 def handle(self, record):

/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/logging/__init__.pyc in handle(self, record)
1258 """
1259 if (not self.disabled) and self.filter(record):
-> 1260 self.callHandlers(record)
1261
1262 def addHandler(self, hdlr):

/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/logging/__init__.pyc in callHandlers(self, record)
1298 found = found + 1
1299 if record.levelno >= hdlr.level:
-> 1300 hdlr.handle(record)
1301 if not c.propagate:
1302 c = None #break out

/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/logging/__init__.pyc in handle(self, record)
742 self.acquire()
743 try:
--> 744 self.emit(record)
745 finally:
746 self.release()

/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/astropy/logger.pyc in _stream_formatter(self, record)
371 color_print(record.levelname, 'brown', end='')
372 else:
--> 373 color_print(record.levelname, 'red', end='')
374 print(": " + record.msg + " [{0:s}]".format(record.origin))
375

/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/astropy/utils/console.pyc in color_print(*args, **kwargs)
136
137 write = file.write
--> 138 if isatty(file) and USE_COLOR():
139 for i in xrange(0, len(args), 2):
140 msg = args[i]

/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/astropy/config/configuration.pyc in __call__(self)
316
317 #get the value from the relevant `configobj.ConfigObj` object

--> 318 sec = get_config(self.module)
319 if self.name not in sec:
320 self.set(self.defaultvalue)

/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/astropy/config/configuration.pyc in get_config(packageormod, reload)
382
383 from .paths import get_config_dir
--> 384 from ..utils import find_current_module
385
386 if packageormod is None:

SystemError: Parent module 'astropy' not loaded, cannot perform relative import
The original exception:
```

Changing the owner from root to my username for /Users/username/.astropy/ seems to have fixed the problem.

I'm using python2.7.2 from enthought, numpy 1.7, and I'm on a mac 10.8.2