Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRITICAL (python 2.7): eGFRD doesn't function without python hack #83

Open
Jintram opened this issue Jul 26, 2012 · 0 comments
Open

CRITICAL (python 2.7): eGFRD doesn't function without python hack #83

Jintram opened this issue Jul 26, 2012 · 0 comments

Comments

@Jintram
Copy link

Jintram commented Jul 26, 2012

eGFRD uses the logger function in Python, which has been updated from python 2.6 to python 2.7.

A check has been introduced which checks if the presented loglevel is a string or not. We however present an object, which leads to the following error:


jintram@jintram-Aspire-7745G:~/jul2012_gfrd_git/samples/simple$ ./simple.py 
Traceback (most recent call last):
  File "./simple.py", line 12, in <module>
    from egfrd import *
  File "/home/jintram/jul2012_gfrd_git/egfrd.py", line 31, in <module>
    from gfrdbase import *
  File "/home/jintram/jul2012_gfrd_git/gfrdbase.py", line 71, in <module>
    setup_logging()
  File "/home/jintram/jul2012_gfrd_git/gfrdbase.py", line 60, in setup_logging
    handler = _gfrd.CppLoggerHandler(_gfrd.Logger.get_logger("ecell"))
  File "/usr/lib/python2.7/logging/__init__.py", line 668, in __init__
    self.level = _checkLevel(level)
  File "/usr/lib/python2.7/logging/__init__.py", line 194, in _checkLevel
    raise TypeError("Level not an integer or a valid string: %r" % level)
TypeError: Level not an integer or a valid string: <_gfrd.Logger object at 0x996510c>

Only if we remove this check from the python code (!) eGFRD currently functions:

$ sudo vim /usr/lib/python2.7/logging/__init__.py
 182 def _checkLevel(level):
 183 
 184     # ugly hack :)
 185     return level
 186 
 187     if isinstance(level, int):
 188         rv = level
 189     elif str(level) == level:
 190         if level not in _levelNames:
 191             raise ValueError("Unknown level: %r" % level)
 192         rv = _levelNames[level]
 193     else:
 194         raise TypeError("Level not an integer or a valid string: %r" % level)
 195     return rv

We should thus use a string instead of an object to pass on loglevel information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant