我要评分
获取效率
正确性
完整性
易理解

Error Reported During Chaste Installation

Symptom

After the make -j48 Continuous command is run, the error message "AttributeError: 'str' object has no attribute 'format'" is displayed.

Key Process and Cause Analysis

Format is a new method for formatting character strings in Python 2.6.

Conclusion and Solution

Run the following command to modify the translators.py file.

vim /path/to/CHASTE/Chaste-release_2019.1/python/pycml/translators.py

Uncomment line 1830 and comment out line 1831.

Uncomment line 1838 and comment out line 1839.

Before the modification:

1830                 #self.writeln('std::cout << "Too small: ', self.code_name(var), ' = " << ', self.code_name(var) , ' << std::endl << std::flush;')
1831                 self.writeln(error_template.format(self.var_display_name(var)))
1832                 self.close_block(False)
1833             for var in high_range_vars:
1834                 if using_cvode:
1835                     additional_tolerance_adjustment = ' + tol'
1836                 self.writeln('if (', self.code_name(var), ' > ', var.get_rdf_annotation(high_prop), additional_tolerance_adjustment, ')')
1837                 self.open_block()
1838                 #self.writeln('std::cout << "Too large: ', self.code_name(var), ' = " << ', self.code_name(var) , ' << std::endl << std::flush;')
1839                 self.writeln(error_template.format(self.var_display_name(var)))

After the modification:

1830                 self.writeln('std::cout << "Too small: ', self.code_name(var), ' = " << ', self.code_name(var) , ' << std::endl << std::flush;')
1831                 #self.writeln(error_template.format(self.var_display_name(var)))
1832                 self.close_block(False)
1833             for var in high_range_vars:
1834                 if using_cvode:
1835                     additional_tolerance_adjustment = ' + tol'
1836                 self.writeln('if (', self.code_name(var), ' > ', var.get_rdf_annotation(high_prop), additional_tolerance_adjustment, ')')
1837                 self.open_block()
1838                 self.writeln('std::cout << "Too large: ', self.code_name(var), ' = " << ', self.code_name(var) , ' << std::endl << std::flush;')
1839                 #self.writeln(error_template.format(self.var_display_name(var)))