Repository: psychopy/psychopy

Issue:
Error in tracker.runSetupProcedure() with possible solution
### Short version:

Problem: 
`raise errorReply` at 
 [https://github.com/psychopy/psychopy/blob/master/psychopy/iohub/client/**init**.py#L1181](url)

Solution:
`raise Exception(errorReply)`
### Long version:

Due to an error 
`TypeError: exceptions must be old-style classes or derived from BaseException, not str`
(see details below) my experiment crashes. 

Since time at the eye tracker is rare, I couldn't reproduce it with bare code.
Primary it appears after I exit the tracker setup procedure (`runSetupProcedure`) after the validation pressing "Esc". The calibration and validation I start from the Psychopy-menu and not from the Eyetracker-PC. I use an Eyelink 1000. The only thing I do directly at the Eyetracking-PC is activating the "auto trigger" from calibration and validation.

Regarding [http://stackoverflow.com/questions/11497234/typeerrorexceptions-must-be-old-style-classes-or-derived-from-baseexception-no](url) 
I changed the "problematic" code at [https://github.com/psychopy/psychopy/blob/master/psychopy/iohub/client/**init**.py#L1181](url) to 
`raise Exception(errorReply)` and the error didn't appear anymore.

Since I can't do further testing I don't dare a pull request.

**ERROR**

```

timeout('timed out',)
['  File "/usr/lib/python2.7/dist-packages/psychopy/iohub/net.py", line 78, in receive\n    data, address = self.sock.recvfrom(self._rcvBufferLength)\n']
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/home/my/experiment.py in <module>()
    307 # ==================================================================== #
    308 ## do the eyetracker setup (initial calibration and validation) ##
--> 309 tracker.runSetupProcedure()
    310 
    311 # ==================================================================== #

/usr/lib/python2.7/dist-packages/psychopy/iohub/client/__init__.pyc in __call__(self, *args, **kwargs)
     56 
     57     def __call__(self, *args,**kwargs):
---> 58         r = self.sendToHub(('EXP_DEVICE','DEV_RPC',self.device_class,self.method_name,args,kwargs))
     59         r=r[1:]
     60         if len(r)==1:

/usr/lib/python2.7/dist-packages/psychopy/iohub/client/__init__.pyc in _sendToHubServer(self, ioHubMessage)
   1179         errorReply=self._isErrorReply(result)
   1180         if errorReply:
-> 1181             raise errorReply
   1182 
   1183         #Otherwise return the result

TypeError: exceptions must be old-style classes or derived from BaseException, not str
```

**Code**

```
import psychopy.iohub as iohub

iohub_tracker_class_path = 'eyetracker.hw.sr_research.eyelink.EyeTracker'
eyetracker_config = dict()
eyetracker_config['name'] = 'tracker'
eyetracker_config['model_name'] = 'EYELINK 1000 DESKTOP'
eyetracker_config['runtime_settings'] = dict(sampling_rate=1000,
                                             track_eyes='LEFT')

io = iohub.launchHubServer(**{iohub_tracker_class_path: eyetracker_config})
tracker  = io.devices.tracker
tracker.runSetupProcedure()
```



Discussion:
Hi @farkau, this change looks pretty straightforward and safe to me. You're welcome to file a pull request any time!


Resolving patch:
diff --git a/psychopy/iohub/client/__init__.py b/psychopy/iohub/client/__init__.py
--- a/psychopy/iohub/client/__init__.py
+++ b/psychopy/iohub/client/__init__.py
@@ -1178,7 +1178,7 @@ def _sendToHubServer(self,ioHubMessage):
         # check if the reply is an error or not. If it is, raise the error.
         errorReply=self._isErrorReply(result)
         if errorReply:
-            raise errorReply
+            raise Exception(errorReply)
 
         #Otherwise return the result
         return result


Test patch: