Giter Site home page Giter Site logo

Comments (4)

mstimberg avatar mstimberg commented on May 16, 2024

Do I understand you correctly that it blocks exceptions in non-Brian programs? How does the except hook get registered if Brian isn't imported?

Whatever the issue is, I think we should have a preference to switch off the except hook.

from brian2.

thesamovar avatar thesamovar commented on May 16, 2024

Something like this:

import brian2
raise ValueError
print "This doesn't happen"

Will just silently terminate.

I guess it's a bug in how our excepthook works on Py 2.6?

from brian2.

mstimberg avatar mstimberg commented on May 16, 2024

It turned out this wasn't a problem with the excepthook but a more general issue with logging: Under Python 2.7+ it's ok to use something like setLevel('DEBUG') (which we use when setting the log levels from the preference file), but in Python 2.6, while not raising an error this leads to comparisons like 10 >= 'DEBUG' later on which then results in no messages being logged :-/
I added a translation from string to number to make this work again. I added a dictionary with the translation, even though such a translation already exists in the logging module: logging.getLevelName('DEBUG') will return 10 -- but the name and the documentation only mention the other direction (logging.getLevelName(10) == 'DEBUG') so I did not want to rely on this.

And this shows a limit of our test suite by the way: We are currently testing the logging system by capturing messages with a special handler -- unfortunately this does not capture problems in the configuration of a handler, as the one in this issue...

from brian2.

thesamovar avatar thesamovar commented on May 16, 2024

Nice fix! I don't think we should worry about the test suite - you can never make it perfect I guess.

from brian2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.