gentnerlab / pyoperant

python package for operant conditioning
BSD 3-Clause "New" or "Revised" License
13 stars 15 forks source link

Behavior crashed for unknown reason (during polling?) #113

Open timsainb opened 8 years ago

timsainb commented 8 years ago

Everything was running smoothly for several weeks until this:

"2016-06-18 12:31:03,255","INFO","response: R"                                                              
"2016-06-18 12:31:05,637","ERROR","Unhandled exception: Traceback (most recent call last):                  
  File "/usr/local/anaconda/bin/behave", line 10, in <module>                                               
    execfile(__file__)                                                                                      
  File "/local/home/bird/Code/pyoperant/scripts/behave", line 135, in <module>                              
    main()                                                                                                  
  File "/local/home/bird/Code/pyoperant/scripts/behave", line 131, in main                                  
    behavior.run()                                                                                          
  File "/local/home/bird/Code/pyoperant/pyoperant/behavior/base.py", line 153, in run                       
    session=self._run_session)                                                                              
  File "/local/home/bird/Code/pyoperant/pyoperant/utils.py", line 103, in run_state_machine                 
    state = state_functions[state]()                                                                        
  File "/local/home/bird/Code/pyoperant/pyoperant/behavior/base.py", line 215, in _run_session              
    post=self.session_post)                                                                                 
  File "/local/home/bird/Code/pyoperant/pyoperant/utils.py", line 103, in run_state_machine                 
    state = state_functions[state]()                                                                        
  File "/local/home/bird/Code/pyoperant/pyoperant/behavior/two_alt_choice.py", line 198, in session_main    
    run_trial_queue()                                                                                       
  File "/local/home/bird/Code/pyoperant/pyoperant/behavior/two_alt_choice.py", line 164, in run_trial_queue 
    self.run_trial()                                                                                        
  File "/local/home/bird/Code/py-behaviors/glab_behaviors/SameDifProbs2.py", line 265, in run_trial         
    self.consequence_main()                                                                                 
  File "/local/home/bird/Code/py-behaviors/glab_behaviors/SameDifProbs2.py", line 391, in consequence_main  
    self.reward_main() # provide a reward                                                                   
  File "/local/home/bird/Code/pyoperant/pyoperant/behavior/two_alt_choice.py", line 520, in reward_main     
    reward_event = self.panel.reward(value=value)                                                           
  File "/local/home/bird/Code/pyoperant/pyoperant/components.py", line 178, in reward                       
    return self.feed(dur=value)                                                                             
  File "/local/home/bird/Code/pyoperant/pyoperant/components.py", line 170, in feed                         
    feed_time = self.up()                                                                                   
  File "/local/home/bird/Code/pyoperant/pyoperant/components.py", line 110, in up                           
    time_up = self.IR.poll(timeout=self.max_lag)                                                            
  File "/local/home/bird/Code/pyoperant/pyoperant/hwio.py", line 39, in poll                                
    return self.interface._poll(timeout=timeout,**self.params)                                              
  File "/local/home/bird/Code/pyoperant/pyoperant/interfaces/comedi_.py", line 55, in _poll                 
    status, output, error = poll_command.run(timeout=timeout)                                               
  File "/local/home/bird/Code/pyoperant/pyoperant/utils.py", line 176, in run                               
    self.process.terminate()                                                                                
AttributeError: 'NoneType' object has no attribute 'terminate'                                              
"                                                                                                           
neuromusic commented 8 years ago

this seems to be happening during the feed.

there's a timeout on the polling... if the feed duration is longer than the timeout on the polling, maybe that's causing a problem?

neuromusic commented 8 years ago

error is in line 110 https://github.com/gentnerlab/pyoperant/blob/master/pyoperant/components.py#L110

neuromusic commented 8 years ago

more specifically in the borrowed function here https://github.com/gentnerlab/pyoperant/blob/master/pyoperant/utils.py#L156