Re: [Discuss-gnuradio] catching unrecognized exception

2014-04-16 Thread Nemanja Savic
Hello again,

Marcus, you are right, my syntax is not any more correct but there is
backwards compatibility. I initiated error on my own and everything works
fine, so I would say there should be rather something more serious.


On Tue, Apr 15, 2014 at 4:31 PM, Marcus Müller mar...@hostalia.de wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Hi Nemanja,

 Simple explanation:
 You haven't fixed your syntax for the first except clause.
 Going back to my other post, it should read
 except mdb.Error as e:, not except mdb.Error, e.

 Because you didn't do that, e is undefined in your except clause.
 This raises a NameError in your except clause, which doesn't get
 handled. Fix the except syntax.

 Also, don't do system.exit() in a multithreaded application, unless
 you really know what you're doing. You'll end up with unfinished data,
 broken database commits and so on.

 Greetings,
 Marcus

 On 15.04.2014 15:40, Nemanja Savic wrote:
  Hi again,
 
  so, the exception appeared again. Just to remind:
  thread[thread-per-block[0]: gr_block db_logger2 (65)]: caught
  unrecognized exception
 
  I can't find what (65) means. This time complete block of code was
  encapsulated by try and except but nothing was caught.
 
  Here is my code:
 
  def handle_msg(self, msg): try: message =
  pmt.pmt_symbol_to_string(msg) msg_lines = message.split('\n')
  sensor_id = msg_lines[0] vendor = msg_lines[2] sensor_type =
  msg_lines[3] time = msg_lines[1] 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) cur = self._con.cursor()
  cur.execute(querry) except mdb.Error, e: print Unexpected error
  while trying to insert into table print 50*'-' print 50*'-' print
  Error %d: %s % (e.args[0],e.args[1]) sys.exit(1)
 
  except: print 'msg handler exception' print 50*'-' print message
  print msg_lines print 50*'-'
 
  Except this function there is also constructor and additional
  function for setting the database up (it is called only in
  constructor). There is no work function as this block nly receives
  messages and writes to database. Is there any idea how can I catch
  this?
 
  Thanx
 
 
 
  On Thu, Mar 20, 2014 at 4:34 PM, Marcus Müller mar...@hostalia.de
  wrote:
 
  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
  vlasi...@gmail.com 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 Discuss-gnuradio@gnu.org
  https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
 
 
  ___ Discuss-gnuradio
  mailing list Discuss-gnuradio@gnu.org
  https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
 
 
 
 
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1
 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

 iQEcBAEBAgAGBQJTTULeAAoJEBQ6EdjyzlHtRIcH/2kpne7BIFs7hb0YyYAEGh00
 Z4oDFaekEmL5j3GSmPojmREqjVvbHCaHohgBDPQh45SleBQ/I88t8GvcNEqZa2VB
 djH9a34uDu/IY5kZTaH2yNisEJq2QNMo6BNjelQTE52u6/53vrBzxgbPgTT1u8Ci
 

Re: [Discuss-gnuradio] catching unrecognized exception

2014-04-16 Thread Nemanja Savic
the last message was not clear.

So, I made sql syntax error and run the program, with my old syntax, and
exception was caught, so the error should be somewhere else.


On Wed, Apr 16, 2014 at 10:45 AM, Nemanja Savic vlasi...@gmail.com wrote:

 Hello again,

 Marcus, you are right, my syntax is not any more correct but there is
 backwards compatibility. I initiated error on my own and everything works
 fine, so I would say there should be rather something more serious.


 On Tue, Apr 15, 2014 at 4:31 PM, Marcus Müller mar...@hostalia.de wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Hi Nemanja,

 Simple explanation:
 You haven't fixed your syntax for the first except clause.
 Going back to my other post, it should read
 except mdb.Error as e:, not except mdb.Error, e.

 Because you didn't do that, e is undefined in your except clause.
 This raises a NameError in your except clause, which doesn't get
 handled. Fix the except syntax.

 Also, don't do system.exit() in a multithreaded application, unless
 you really know what you're doing. You'll end up with unfinished data,
 broken database commits and so on.

 Greetings,
 Marcus

 On 15.04.2014 15:40, Nemanja Savic wrote:
  Hi again,
 
  so, the exception appeared again. Just to remind:
  thread[thread-per-block[0]: gr_block db_logger2 (65)]: caught
  unrecognized exception
 
  I can't find what (65) means. This time complete block of code was
  encapsulated by try and except but nothing was caught.
 
  Here is my code:
 
  def handle_msg(self, msg): try: message =
  pmt.pmt_symbol_to_string(msg) msg_lines = message.split('\n')
  sensor_id = msg_lines[0] vendor = msg_lines[2] sensor_type =
  msg_lines[3] time = msg_lines[1] 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) cur = self._con.cursor()
  cur.execute(querry) except mdb.Error, e: print Unexpected error
  while trying to insert into table print 50*'-' print 50*'-' print
  Error %d: %s % (e.args[0],e.args[1]) sys.exit(1)
 
  except: print 'msg handler exception' print 50*'-' print message
  print msg_lines print 50*'-'
 
  Except this function there is also constructor and additional
  function for setting the database up (it is called only in
  constructor). There is no work function as this block nly receives
  messages and writes to database. Is there any idea how can I catch
  this?
 
  Thanx
 
 
 
  On Thu, Mar 20, 2014 at 4:34 PM, Marcus Müller mar...@hostalia.de
  wrote:
 
  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
  vlasi...@gmail.com 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 Discuss-gnuradio@gnu.org
  https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
 
 
  ___ Discuss-gnuradio
  mailing list Discuss-gnuradio@gnu.org
  https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
 
 
 
 
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1
 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

 

Re: [Discuss-gnuradio] catching unrecognized exception

2014-04-16 Thread Marcus Müller
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Mike,
it's not. It's part of the block name ;):

gnuradio-runtime/include/gnuradio/thread/thread_body_wrapper.h:63
std::cerr  thread[  d_name  ]: 
   caught unrecognized exception\n;

Greetings,
Marcus

On 15.04.2014 16:21, Mike Jameson wrote:
 The '(65)' looks to be the line number where the error occured.
 Notice that previously the line number was '(62)' which probably
 means that the error is coming from line 65 of one of the files you
 have been editing.
 
 Mike
 
 -- Mike Jameson M0MIK BSc MIET Email: m...@scanoo.com Web:
 http://scanoo.com
 
 
 On Tue, Apr 15, 2014 at 2:40 PM, Nemanja Savic vlasi...@gmail.com
 wrote:
 
 Hi again,
 
 so, the exception appeared again. Just to remind: 
 thread[thread-per-block[0]: gr_block db_logger2 (65)]: caught 
 unrecognized exception
 
 I can't find what (65) means. This time complete block of code
 was encapsulated by try and except but nothing was caught.
 
 Here is my code:
 
 def handle_msg(self, msg): try:
 
 message = pmt.pmt_symbol_to_string(msg) msg_lines =
 message.split('\n') sensor_id = msg_lines[0] vendor =
 msg_lines[2] sensor_type = msg_lines[3] time = msg_lines[1] 
 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) cur = self._con.cursor() 
 cur.execute(querry) except mdb.Error, e: print Unexpected error
 while trying to insert into table print 50*'-'
 
 print 50*'-' print Error %d: %s % (e.args[0],e.args[1]) 
 sys.exit(1)
 
 except: print 'msg handler exception' print 50*'-' print message
 
 print msg_lines print 50*'-'
 
 
 Except this function there is also constructor and additional
 function for setting the database up (it is called only in
 constructor). There is no work function as this block nly
 receives messages and writes to database. Is there any idea how
 can I catch this?
 
 Thanx
 
 
 
 On Thu, Mar 20, 2014 at 4:34 PM, Marcus Müller
 mar...@hostalia.de wrote:
 
 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
 vlasi...@gmail.com 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 Discuss-gnuradio@gnu.org 
 https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
 
 
 ___ 
 Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org 
 https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
 
 
 
 
 -- Nemanja Savić
 
 ___ Discuss-gnuradio
 mailing list Discuss-gnuradio@gnu.org 
 https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
 
 
 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTTlLJAAoJEBQ6EdjyzlHt2n0H/iWnLcFLeHfVVMGEZhmhwLoF
pQKQYPyMFSsSjUJkGgDZepeJJb5/VIGwcwwp2sdhIJ3CuVqpeVjkg9PSOol+aBa0
akS48lZdeOySfLoxzC4e/KX9lmr2cyQ9nsD5oOKRDHd9gkkmKi3yztMBpFRHoQWj
jO/EBDnSHP6dMdmbXhii05TdADBt99oSxBbyBvI+pSvZCuosROiKi0cN0jKVbj0L
v+Y7m5yYanXyGpZqe5pGwR0ZkWpPPw6uEn7bKYu6Uh/TI6e26xBN4AfkrxnYRcK+

Re: [Discuss-gnuradio] catching unrecognized exception

2014-04-16 Thread Marcus Müller
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Nemanja,

ah that's interesting, I've tried and for me, it fails. Strange. I'm
going to investigate that.

However, if that syntax is ok, then I'm out of ideas. You're not
giving out all too much details, though. When excatly does this
exception occur? Does your block work at all? Does it work when
commenting out functionality? How about print done this and that
debugging? Do your two blocks share the same database connection (if
that's the case, are you doing multithreading correctly?)?

My only guess would still be that one of your except clauses throws an
Exception. Maybe print message, if message = pmt.symbol_to_string()
failed?

By the way, caught unrecognized exception comes from the C++ domain,
it happens when there is an uncaught C++ exception, which might have
nothing to do with your executed python.

What you can do is run your program in a debugger, i.e.

$ gdb --args python your_python_flowgraph.py
...
(gdb)run
...
interrupt (ctrl-z), try to set a breakpoint at
gnuradio-runtime/include/gnuradio/thread/thread_body_wrapper.h:61 ,
then continue running your program
(gdb)cont
...
and see what happened prior to that call:
(gdb)bt


Greetings,
Marcus

On 16.04.2014 10:45, Nemanja Savic wrote:
 Hello again,
 
 Marcus, you are right, my syntax is not any more correct but there
 is backwards compatibility. I initiated error on my own and
 everything works fine, so I would say there should be rather
 something more serious.
 
 
 On Tue, Apr 15, 2014 at 4:31 PM, Marcus Müller mar...@hostalia.de
 wrote:
 
 Hi Nemanja,
 
 Simple explanation: You haven't fixed your syntax for the first
 except clause. Going back to my other post, it should read except
 mdb.Error as e:, not except mdb.Error, e.
 
 Because you didn't do that, e is undefined in your except
 clause. This raises a NameError in your except clause, which
 doesn't get handled. Fix the except syntax.
 
 Also, don't do system.exit() in a multithreaded application,
 unless you really know what you're doing. You'll end up with
 unfinished data, broken database commits and so on.
 
 Greetings, Marcus
 
 On 15.04.2014 15:40, Nemanja Savic wrote:
 Hi again,
 
 so, the exception appeared again. Just to remind: 
 thread[thread-per-block[0]: gr_block db_logger2 (65)]:
 caught unrecognized exception
 
 I can't find what (65) means. This time complete block of
 code was encapsulated by try and except but nothing was
 caught.
 
 Here is my code:
 
 def handle_msg(self, msg): try: message = 
 pmt.pmt_symbol_to_string(msg) msg_lines =
 message.split('\n') sensor_id = msg_lines[0] vendor =
 msg_lines[2] sensor_type = msg_lines[3] time = msg_lines[1]
 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) cur = self._con.cursor() 
 cur.execute(querry) except mdb.Error, e: print Unexpected
 error while trying to insert into table print 50*'-' print
 50*'-' print Error %d: %s % (e.args[0],e.args[1])
 sys.exit(1)
 
 except: print 'msg handler exception' print 50*'-' print
 message print msg_lines print 50*'-'
 
 Except this function there is also constructor and
 additional function for setting the database up (it is called
 only in constructor). There is no work function as this block
 nly receives messages and writes to database. Is there any
 idea how can I catch this?
 
 Thanx
 
 
 
 On Thu, Mar 20, 2014 at 4:34 PM, Marcus Müller
 mar...@hostalia.de wrote:
 
 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 
 vlasi...@gmail.com 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`, 

Re: [Discuss-gnuradio] catching unrecognized exception

2014-04-15 Thread Nemanja Savic
Hi again,

so, the exception appeared again. Just to remind:
thread[thread-per-block[0]: gr_block db_logger2 (65)]: caught
unrecognized exception

I can't find what (65) means.
This time complete block of code was encapsulated by try and except but
nothing was caught.

Here is my code:

def handle_msg(self, msg):
try:
message = pmt.pmt_symbol_to_string(msg)
msg_lines = message.split('\n')
sensor_id = msg_lines[0]
vendor = msg_lines[2]
sensor_type = msg_lines[3]
time = msg_lines[1]
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)
cur = self._con.cursor()
cur.execute(querry)
except mdb.Error, e:
print Unexpected error while trying to insert into table
print 50*'-'
print 50*'-'
print Error %d: %s % (e.args[0],e.args[1])
sys.exit(1)

except:
print 'msg handler exception'
print 50*'-'
print message
print msg_lines
print 50*'-'

Except this function there is also constructor and additional function for
setting the database up (it is called only in constructor). There is no
work function as this block nly receives messages and writes to database.
Is there any idea how can I catch this?

Thanx



On Thu, Mar 20, 2014 at 4:34 PM, Marcus Müller mar...@hostalia.de wrote:

 -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 vlasi...@gmail.com
  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 Discuss-gnuradio@gnu.org
  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-

 ___
 Discuss-gnuradio mailing list
 Discuss-gnuradio@gnu.org
 https://lists.gnu.org/mailman/listinfo/discuss-gnuradio




-- 
Nemanja Savić
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] catching unrecognized exception

2014-04-15 Thread Nemanja Savic
It's commented line inside the function called only once inside
constructor, and never again :)


On Tue, Apr 15, 2014 at 4:21 PM, Mike Jameson m...@scanoo.com wrote:

 The '(65)' looks to be the line number where the error occured.  Notice
 that previously the line number was '(62)' which probably means that the
 error is coming from line 65 of one of the files you have been editing.

 Mike

 --
 Mike Jameson M0MIK BSc MIET
 Email: m...@scanoo.com
 Web: http://scanoo.com


 On Tue, Apr 15, 2014 at 2:40 PM, Nemanja Savic vlasi...@gmail.com wrote:

 Hi again,

 so, the exception appeared again. Just to remind:
 thread[thread-per-block[0]: gr_block db_logger2 (65)]: caught
 unrecognized exception

 I can't find what (65) means.
 This time complete block of code was encapsulated by try and except but
 nothing was caught.

 Here is my code:

 def handle_msg(self, msg):
 try:

 message = pmt.pmt_symbol_to_string(msg)
 msg_lines = message.split('\n')
 sensor_id = msg_lines[0]
 vendor = msg_lines[2]
 sensor_type = msg_lines[3]
 time = msg_lines[1]
 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)
  cur = self._con.cursor()
 cur.execute(querry)
 except mdb.Error, e:
 print Unexpected error while trying to insert into table
 print 50*'-'

 print 50*'-'
 print Error %d: %s % (e.args[0],e.args[1])
 sys.exit(1)

 except:
 print 'msg handler exception'
 print 50*'-'
 print message

 print msg_lines
 print 50*'-'


 Except this function there is also constructor and additional function
 for setting the database up (it is called only in constructor). There is no
 work function as this block nly receives messages and writes to database.
 Is there any idea how can I catch this?

 Thanx



 On Thu, Mar 20, 2014 at 4:34 PM, Marcus Müller mar...@hostalia.dewrote:

 -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 vlasi...@gmail.com
  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 Discuss-gnuradio@gnu.org
  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-

 ___
 Discuss-gnuradio mailing list
 Discuss-gnuradio@gnu.org
 

Re: [Discuss-gnuradio] catching unrecognized exception

2014-04-15 Thread Marcus Müller
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Nemanja,

Simple explanation:
You haven't fixed your syntax for the first except clause.
Going back to my other post, it should read
except mdb.Error as e:, not except mdb.Error, e.

Because you didn't do that, e is undefined in your except clause.
This raises a NameError in your except clause, which doesn't get
handled. Fix the except syntax.

Also, don't do system.exit() in a multithreaded application, unless
you really know what you're doing. You'll end up with unfinished data,
broken database commits and so on.

Greetings,
Marcus

On 15.04.2014 15:40, Nemanja Savic wrote:
 Hi again,
 
 so, the exception appeared again. Just to remind: 
 thread[thread-per-block[0]: gr_block db_logger2 (65)]: caught 
 unrecognized exception
 
 I can't find what (65) means. This time complete block of code was
 encapsulated by try and except but nothing was caught.
 
 Here is my code:
 
 def handle_msg(self, msg): try: message =
 pmt.pmt_symbol_to_string(msg) msg_lines = message.split('\n') 
 sensor_id = msg_lines[0] vendor = msg_lines[2] sensor_type =
 msg_lines[3] time = msg_lines[1] 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) cur = self._con.cursor() 
 cur.execute(querry) except mdb.Error, e: print Unexpected error
 while trying to insert into table print 50*'-' print 50*'-' print
 Error %d: %s % (e.args[0],e.args[1]) sys.exit(1)
 
 except: print 'msg handler exception' print 50*'-' print message 
 print msg_lines print 50*'-'
 
 Except this function there is also constructor and additional
 function for setting the database up (it is called only in
 constructor). There is no work function as this block nly receives
 messages and writes to database. Is there any idea how can I catch
 this?
 
 Thanx
 
 
 
 On Thu, Mar 20, 2014 at 4:34 PM, Marcus Müller mar...@hostalia.de
 wrote:
 
 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
 vlasi...@gmail.com 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 Discuss-gnuradio@gnu.org 
 https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
 
 
 ___ Discuss-gnuradio
 mailing list Discuss-gnuradio@gnu.org 
 https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
 
 
 
 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTTULeAAoJEBQ6EdjyzlHtRIcH/2kpne7BIFs7hb0YyYAEGh00
Z4oDFaekEmL5j3GSmPojmREqjVvbHCaHohgBDPQh45SleBQ/I88t8GvcNEqZa2VB
djH9a34uDu/IY5kZTaH2yNisEJq2QNMo6BNjelQTE52u6/53vrBzxgbPgTT1u8Ci
XxST0WUnpIyHemBGZK7cR6WAiGffimXpA3Rr5vH0c6WK2ytIM9BCvtRd9T2o+bOc
GnXNqcV0Rny/j53i4rfbxuynI8Y+FROcASZUPo/IjZQOA/Sp2R0UkMQZGXzLUAB1
x8Ugy1uDe+p+qgBxUVC7AE5+0s0E2R/H4EmzP9HcluiXqMhzPfHwux2ghjfXoyc=
=5274
-END PGP SIGNATURE-

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] catching unrecognized exception

2014-03-20 Thread Nemanja Savic
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 vlasi...@gmail.com 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ć




-- 
Nemanja Savić
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] catching unrecognized exception

2014-03-20 Thread Marcus Müller
-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 vlasi...@gmail.com
 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 Discuss-gnuradio@gnu.org 
 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-

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio