Roger Demetrescu wrote: > > On 4/11/07, King Simon-NFHD78 <[EMAIL PROTECTED]> wrote: > > > > I've got no idea about the source of the problem, but it > would probably > > be helpful if you could provide stack traces from the exceptions, if > > that's possible. > > > Do you mean using the traceback module ? I've just searched about it > and I guess I should use this: > > try: > # do my stuff > except: > traceback.print_exc(file=sys.stdout) > raise > > > Is this the best way to show the stack trace ? >
That would be one way to do it. If you are using the python logging module, another way would be to use the logger.exception method, which automatically adds the exception info, including the traceback, into the log message. Ie. try: # do your stuff except: logging.exception('Oops, an exception occurred') # or use <your_logger_instance>.exception raise > > > > > Other than that, I would have thought you should be able to > track down > > the source of the 'global name' exception by grepping your > source code > > for uses of 'anxnews_urllocal' without a '.' in front of it. Is it > > possible that you are doing something like this, for example: > > > > query.select_by(anxnews_urllocal > 5) > > > > When you probably mean: > > > > query.select_by(table.c.anxnews_urllocal > 5) > > Man, you got it !! :) > > The only line of my simple code that have a "anxnews_urllocal" without > a preceding "." is here: > > ============ > if anexo.anxnews_tipof == Anexo.IMAGEM: > cronometro.start() > renamed, size = _gerar_thumbs(local, > SIZE_WEB, SIZE_THUMB) > if renamed: > anexo.anxnews_urllocal = > posixpath.splitext(anxnews_urllocal)[0] + ".jpg" > ============ > > This "renamed" condition is very rare... It only occurs when I'm > dealing with a BMP image... > And my log file confirms that.. I was manipulating a BMP image... :D > > So I'm changing "splitext(anxnews_urllocal)" to > "splitext(anexo.anxnews_urllocal)" > > > > Hope that helps, > > It sure helped... > > > Thanks ! > > Roger > Well, it certainly makes a change - normally I'm the one asking the questions ;-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---