Open paulsh1957 opened 5 years ago
Thank you for reporting this error. Does this error also occur with the latest version (2.2.1)? Could you also copy the complete traceback here?
I too came across this error with using trunk version with running water example from tutorials.
Python Verison: Python 2.7.15rc1
Traceback (most recent call last):
File "qff-derive.py", line 29, in <module>
with log.section('INIT', 2, timer='Initialization'):
File "/usr/local/lib/python2.7/dist-packages/quickff/log.py", line 88, in __enter__
if self.new_label!=self.old_label and self.logger.log_level>0:
AttributeError: 'Logger' object has no attribute 'log_level'
I too came across this error with using trunk version with running water example from tutorials.
Python Verison: Python 2.7.15rc1
Traceback (most recent call last): File "qff-derive.py", line 29, in <module> with log.section('INIT', 2, timer='Initialization'): File "/usr/local/lib/python2.7/dist-packages/quickff/log.py", line 88, in __enter__ if self.new_label!=self.old_label and self.logger.log_level>0: AttributeError: 'Logger' object has no attribute 'log_level'
Initialization of log_level
attribute to 0 (quickff/log.py)
in the class Logger
did the trick
self.add_blank_line = False
self.timetable = []
+ self.log_level = 0
Initialization of the log level is taken care of by the first line of Logger.init, i.e. _self.setlevel(level) . Furthermore, to import the logger in a QuickFF script, one has to import a pre-initialized instance of Logger. This means that you should NOT do
from quickff.log import Logger log = Logger('high')
but instead
from quickff.log import log log.set_level('high')
You can offcourse skip the second line if you are satisfied with the default log_level (i.e. medium). In the tutorials from the online documentation we do not discuss the import statements (which is were the QuickFF logger is initialized as discussed above). If you have a look at the intire script qff-derive.py (which you can decollapse from the documentation page, eg. http://molmod.github.io/QuickFF/tu.html#tutorial-2-water), you will see that there is indeed a line from quickff.log import log.
After running setup.py install using Enthought's Canopy python environment on a MacBook Pro running MacOS High Sierra 10.13.6 I ran the water tutorial with the files provided. An error occurred at line 150 in quickff log.py. The error was 'AttributeError: "Logger' object has no attribute 'log_level''. This was code provided in quickff-master version 2.2.0 downloaded and run unchanged. What might be causing this error? How can I fix this error?