Skip to content

Commit 7595b6a

Browse files
amarkpaynemjohnson541
authored andcommitted
Convert print statements to logging statements
Remove print statements in main.py and library.py that would otherwise print regardless of logging level.
1 parent 3c83a90 commit 7595b6a

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

rmgpy/data/kinetics/library.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,23 +218,23 @@ def convertDuplicatesToMulti(self):
218218
Merge all marked duplicate reactions in the kinetics library
219219
into single reactions with multiple kinetics.
220220
"""
221-
print "trying to find duplicates"
221+
logging.debug("Searching for duplicate reactions...")
222222
entries_to_remove = []
223223
for entry0 in self.entries.values():
224224
if entry0 in entries_to_remove:
225225
continue
226226
reaction0 = entry0.item
227227
if not reaction0.duplicate:
228228
continue
229-
print "Found a duplicate reaction: {0}".format(reaction0)
229+
logging.debug("Found a duplicate reaction: {0}".format(reaction0))
230230
duplicates = [entry0]
231231
for entry in self.entries.values():
232232
reaction = entry.item
233233
if reaction0 is reaction:
234234
continue
235235
if reaction0.isIsomorphic(reaction, eitherDirection=False):
236236
if reaction0.reversible != reaction.reversible:
237-
print "Reactions isomorphic but with different reversibilities"
237+
logging.debug("Reactions isomorphic but with different reversibilities.")
238238
continue
239239
duplicates.append(entry)
240240
if len(duplicates)<=1:
@@ -271,9 +271,9 @@ def convertDuplicatesToMulti(self):
271271
entry0.longDesc = longDesc
272272
entries_to_remove.extend(duplicates[1:])
273273
for entry in entries_to_remove:
274-
print "removing duplicate reaction with index {0}.".format(entry.index)
274+
logging.debug("Removing duplicate reaction with index {0}.".format(entry.index))
275275
del(self.entries[entry.index])
276-
print "NB. the entries have not been renumbered, so these indices are missing."
276+
logging.debug("NB. the entries have not been renumbered, so these indices are missing.")
277277

278278

279279
def load(self, path, local_context=None, global_context=None):

rmgpy/rmg/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,9 +1502,9 @@ def initializeLog(verbose, log_file_name):
15021502
if os.path.exists(log_file_name):
15031503
backup = os.path.join(log_file_name[:-7], 'RMG_backup.log')
15041504
if os.path.exists(backup):
1505-
print "Removing old "+backup
1505+
logging.info("Removing old "+backup)
15061506
os.remove(backup)
1507-
print 'Moving {0} to {1}\n'.format(log_file_name, backup)
1507+
logging.info('Moving {0} to {1}\n'.format(log_file_name, backup))
15081508
shutil.move(log_file_name, backup)
15091509
fh = logging.FileHandler(filename=log_file_name) #, backupCount=3)
15101510
fh.setLevel(min(logging.DEBUG,verbose)) # always at least VERBOSE in the file

0 commit comments

Comments
 (0)