Pickle Problem

MRAB google at mrabarnett.plus.com
Tue Mar 3 19:00:30 EST 2009


Fab86 wrote:
> On Mar 3, 8:59 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:
>> En Tue, 03 Mar 2009 16:50:25 -0200, Fab86 <fabien.h... at gmail.com> escribió:
>>
>>
>>
>>> On Mar 3, 6:48 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:
>>>> En Tue, 03 Mar 2009 16:39:43 -0200, Fab86 <fabien.h... at gmail.com>  
>>>> escribió:
>>>>> I am having a bit on an issue getting my program to work. The online
>>>>> database which I am trying to contact keep timing out meaning I can
>>>>> not carry out my 200 searches without being interupted.
>>>>> I believe that the solution would be to include an exception handler
>>>>> with a timer delay if this error occurs so wait a bit then carry on
>>>>> however having spent hours looking at this I can not get my head
>>>>> around how to do such a thing.
>>>> Exactly. How to handle  
>>>> exceptions:http://docs.python.org/tutorial/errors.html
>>>> Use time.sleep() to wait for some  
>>>> time:http://docs.python.org/library/time.html#time.sleep
>>> Thanks for that I will give it a read.
>>> Do I need to know what error I am getting?
>> Usually it's best to be as specific as possible.
>>
>>
>>
>>> IDLE is giving me this:
>>> Traceback (most recent call last):
>>>   File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\test6.py", line
>>> 13, in <module>
>>>     res = srch.parse_results()
>>>   File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\yahoo\search
>>> \__init__.py", line 765, in parse_results
>>>     xml = self.get_results()
>>>   File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\yahoo\search
>>> \__init__.py", line 738, in get_results
>>>     stream = self.open()
>>>   File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\yahoo\search
>>> \__init__.py", line 723, in open
>>>     raise SearchError(err)
>>> SearchError: service temporarily unavailable [C:28]
>> That means that, in line 13 of test6.py [first line in the stack trace],  
>> after several function calls [intermediate lines in the stack trace]  
>> leading to function open in the search package [last line of the stack  
>> trace], a SearchError exception was raised.
>> If you want to catch that exception:
>>
>> try:
>>     ... some code ...
>> except SearchError:
>>    ... code to handle the exception ...
>>
>> How to "spell" exactly the exception name should appear in the  
>> documentation; might be yahoo.SearchError, or yahoo.search.SearchError, or  
>> yahoo.errors.SearchError, or similar.
>>
> 
> I have been trying except SearchError: however I get the error:
> 
> Traceback (most recent call last):
>   File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\timeDelay.py",
> line 19, in <module>
>     except SearchError:
> NameError: name 'SearchError' is not defined
> 
> I have searched all documents for terms along the lines of searcherror
> but am finding nothing..
> 
> Any ideas?
> 
It's defined in the module you imported to get the search functionality.



More information about the Python-list mailing list