astropy/astropy — pull request #1256 by embray (2013-09-09 20:09:37+00:00)
Title: AttributeError in _find_pkg_data_path with Python 3.2

Using `get_pkg_data_filename` fails for me in one case on Python 3.2 only (works on 2.7 and 3.3) like this:
```
In [2]: tevpy.data.poisson_stats_image()
ERROR: AttributeError: 'NoneType' object has no attribute 'split' [astropy.utils.data]
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
in ()
----> 1 tevpy.data.poisson_stats_image()

/Users/deil/Library/Python/3.2/lib/python/site-packages/tevpy-0.1-py3.2-macosx-10.8-x86_64.egg/tevpy/data/__init__.py in poisson_stats_image(extra_info)
70 else:
71 filename = 'poisson_stats_image/counts.fits.gz'
---> 72 out = fits.getdata(get_pkg_data_filename(filename))
73
74 return out

/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/astropy/utils/data.py in get_pkg_data_filename(data_name)
451 return hashfn
452 else:
--> 453 datafn = _find_pkg_data_path(data_name)
454 if os.path.isdir(datafn):
455 raise IOError("Tried to access a data file that's actually "

/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/astropy/utils/data.py in _find_pkg_data_path(data_name)
691 # not called from inside an astropy package. So just pass name through
692 return data_name
--> 693 rootpkgname = module.__package__.split('.')[0]
694
695 rootpkg = __import__(rootpkgname)

AttributeError: 'NoneType' object has no attribute 'split'
```
Example is here:
https://travis-ci.org/gammapy/tevpy/jobs/9024931#L459

@iguananaut @eteq This is a continuation of the discussion here:
https://github.com/astropy/astropy/issues/1241#issuecomment-20906803