Repository: weecology/retriever

Issue:
Bug in OSX 10.9.2 install
Okay, @ethanwhite I installed form source by cloning repo, and `python setup.py install`

On the cli I typed

```
$ retriever
```

Worked for a bit, then got error

```
Downloading script: EA_mom2003.script
0.0-EA_mom2003.script 100.0-EA_mom2003.script Downloading script: bbs50stop.py
0.0-bbs50stop.py 70.9-bbs50stop.py 100.0-bbs50stop.py Downloading script: EA_pantheria.script
0.0-EA_pantheria.script 100.0-EA_pantheria.script Downloading script: EA_capellini2010.script
0.0-EA_capellini2010.script 100.0-EA_capellini2010.script Downloading script: EA_barnes2008.script
0.0-EA_barnes2008.script 100.0-EA_barnes2008.script Downloading script: EA_zachmann2010.script
0.0-EA_zachmann2010.script 100.0-EA_zachmann2010.script Downloading script: EA_mcglinn2010.script
0.0-EA_mcglinn2010.script 100.0-EA_mcglinn2010.script Downloading script: EA_del_moral_2010.script
0.0-EA_del_moral_2010.script 100.0-EA_del_moral_2010.script Downloading script: EA_avianbodysize2007.script
0.0-EA_avianbodysize2007.script 100.0-EA_avianbodysize2007.script Downloading script: EA_clark2006.py
0.0-EA_clark2006.py 100.0-EA_clark2006.py Downloading script: USDA_plants.script
0.0-USDA_plants.script 100.0-USDA_plants.script Downloading script: gentry.py
0.0-gentry.py 81.4-gentry.py 100.0-gentry.py Downloading script: EA_thibault2011.script
0.0-EA_thibault2011.script 100.0-EA_thibault2011.script Downloading script: EA_ramesh2010.script
0.0-EA_ramesh2010.script 100.0-EA_ramesh2010.script Downloading script: bbs.py
0.0-bbs.py 80.7-bbs.py 100.0-bbs.py Downloading script: bioclim_2pt5.py
0.0-bioclim_2pt5.py 100.0-bioclim_2pt5.py Downloading script: EA_adler2007.script
0.0-EA_adler2007.script 100.0-EA_adler2007.script Downloading script: EA_ernest2003.script
0.0-EA_ernest2003.script 100.0-EA_ernest2003.script Downloading script: MammalSuperTree.py
0.0-MammalSuperTree.py 100.0-MammalSuperTree.py Downloading script: EA_petraitis2008.py
0.0-EA_petraitis2008.py 100.0-EA_petraitis2008.py Downloading script: EA_portal_mammals.script
0.0-EA_portal_mammals.script 100.0-EA_portal_mammals.script Downloading script: EA_woods2009.script
0.0-EA_woods2009.script 100.0-EA_woods2009.script Downloading script: fia.py
0.0-fia.py 100.0-fia.py Downloading script: npn.py
0.0-npn.py 100.0-npn.py
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/bin/retriever", line 9, in <module>
    load_entry_point('retriever==1.6', 'console_scripts', 'retriever')()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/retriever-1.6-py2.7.egg/retriever/__main__.py", line 34, in main
    from retriever.app.main import launch_app
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/retriever-1.6-py2.7.egg/retriever/app/main.py", line 10, in <module>
    from retriever.app.app import App
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/retriever-1.6-py2.7.egg/retriever/app/app.py", line 3, in <module>
    import wx
ImportError: No module named wx
```

Tried `pip install wx`, but no module with that name. 



Discussion:
Just had to install `wxPython`, then run `python setup.py install` again and works


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -2,6 +2,8 @@
 
 from setuptools import setup
 import platform
+import sys
+import warnings
 
 p = platform.platform().lower()
 extra_includes = []
@@ -18,6 +20,13 @@
 from __init__ import VERSION
 
 
+def is_wxpython_installed():
+    """Returns True if  wxpython is installed"""
+    try:
+        return __import__("wxpython")
+    except ImportError:
+        return False
+
 def clean_version(v):
     if v == 'master':
         return '1.0.0'
@@ -37,7 +46,7 @@ def clean_version(v):
             'psycopg2',
             'sqlite3',
             ] + extra_includes
-            
+
 excludes = [
             'pyreadline',
             'doctest',
@@ -55,6 +64,16 @@ def clean_version(v):
             ]
 
 
+wx_installed = is_wxpython_installed()
+
+if wx_installed is False:
+    warnings.warn("""wxpython is not installed.
+                  Retriever will not work in GUI mode.
+                  For retriever-gui install python-wxpython and
+                  run 'python setup.py install' again.""",
+                  UserWarning
+                  )
+
 setup(name='retriever',
       version=clean_version(VERSION),
       description='EcoData Retriever',


Test patch: