discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] catching unrecognized exception


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] catching unrecognized exception
Date: Thu, 20 Mar 2014 16:34:53 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Nemanja,

your except syntax is wrong, most probably you wanted to use "except
ExceptionType as e" instead, refer to
http://docs.python.org/2/tutorial/errors.html

Anyway, have you tried surrounding all your handler code with a try
and catch not only the database related errors?

Greetings,
Marcus

On 20.03.2014 15:58, Nemanja Savic wrote:
> Dear gnuradioers,
> 
> I would like to ask againi if somebody can help me understand
> this: thread[thread-per-block[0]: <gr_block db_logger2 (62)>]:
> caught unrecognized exception
> 
> I have two blocks of db_logger type and it looks like only one
> catch this unrecognized exception and another keeps working fine.
> 
> best and thank you
> 
> 
> On Mon, Mar 3, 2014 at 12:55 PM, Nemanja Savic <address@hidden>
> wrote:
> 
>> Hi all guys,
>> 
>> I have a block which is responsible to receive certain messages
>> from other blocks and to write the data from the message into
>> database. Sometimes the following exception occures and the block
>> stops writing into database:
>> 
>> thread[thread-per-block[0]: <gr_block db_logger2 (62)>]: caught 
>> unrecognized exception
>> 
>> The structure of the block is really simple:
>> 
>> def handle_msg(self, msg): message =
>> pmt.pmt_symbol_to_string(msg) msg_lines = message.split('\n') 
>> try: sensor_id = msg_lines[0] vendor = msg_lines[2] sensor_type =
>> msg_lines[3] time = msg_lines[1] #try: querry = "INSERT INTO
>> `%s`.`%s` (`id` ,`sens_id` ,`vendor`, `sensor_type`, `det_id`)
>> VALUES (NULL , '%s', '%s', '%s','%s');" % (self._db_name,
>> self._det_table, sensor_id, vendor, sensor_type, self._id) #
>> print querry cur = self._con.cursor() cur.execute(querry) except
>> mdb.Error, e: print "Unexpected error while trying to insert into
>> table" print msg_lines print 50*'-' print "Error %d: %s" %
>> (e.args[0],e.args[1]) sys.exit(1)
>> 
>> Is there any way to track this problem and find the cause?
>> 
>> Best regards,
>> 
>> -- Nemanja Savić
>> 
> 
> 
> 
> 
> 
> _______________________________________________ Discuss-gnuradio
> mailing list address@hidden 
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTKwqdAAoJEBQ6EdjyzlHtxrcIALIUmmcUY3OJ8Bnr2g9tYhB1
rQkOyCaES+4b8bocZIyoUTF7M/N5FA9TmITxvnhZgqcvl0Kb1BaFc9F0H9Tbb4w4
EJtIV6HVLu1jSQAqwMT1jLT3ATbWzH108om/jDx7Wai3Jb64WrVaMxlDuJPJFlK/
fjVSrGXwcEZRt/8SVbeRmItipo9Y551rNerULo8/4VSiFz30QVyh/zFwNWAGwavA
xNQPA7OAq4SImyofUGU0E8IsyY9YMcgSlATZYSoKJDbcrFWtrfGJdnuOOV55bgKJ
l/SouuiObel3WLdzk6861vITRbxyVrPOdsts9ins/G9+Z1wZMKKRz/dh6POevmA=
=yTTM
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]