Skip to content

Instantly share code, notes, and snippets.

@dpshelio
Created August 1, 2013 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpshelio/6131758 to your computer and use it in GitHub Desktop.
Save dpshelio/6131758 to your computer and use it in GitHub Desktop.
Astropy import error from a web application.
/usr/local/lib/python2.7/dist-packages/astropy/config/configuration.py:432: ConfigurationMissingWarning: Configuration defaults will be used, and configuration cannot be saved due to OSError:Could not find unix home directory to search for astropy config dir
warn(ConfigurationMissingWarning(msg))
/usr/local/lib/python2.7/dist-packages/astropy/logger.py:490: RuntimeWarning: log file '' could not be opened for writing: Could not find unix home directory to search for astropy config dir
'{1}'.format(log_file_path, unicode(e)), RuntimeWarning)
Traceback (most recent call last):
File "testastropy.py", line 2, in <module>
import astropy
File "/usr/local/lib/python2.7/dist-packages/astropy/__init__.py", line 153, in <module>
config.configuration.update_default_config(__package__, config_dir)
File "/usr/local/lib/python2.7/dist-packages/astropy/config/configuration.py", line 688, in update_default_config
if os.path.exists(cfgfn):
File "/usr/lib/python2.7/genericpath.py", line 18, in exists
os.stat(path)
TypeError: coercing to Unicode: need string or buffer, NoneType found
import json
import astropy
result = {'version': astropy.__version__}
print json.dumps(result)
<?php
$result = shell_exec('python testastropy.py');
$resultData = json_decode($result, true);
var_dump($resultData);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment