Opened 6 years ago

Last modified 6 years ago

#13 closed defect

import quietly — at Version 1

Reported by: zhangjr Owned by: somebody
Priority: major Milestone:
Component: component1 Version:
Keywords: Cc:
Blocked By: Blocking:
Parent ID: Parent Tickets:
Estimated Number of Hours: 0.0 Add Hours to Ticket: 0
Billable?: yes Total Hours: 0

Description (last modified by zhangjr)

When importing mantid and sqlalchemy modules, some warning show. In most cases, we can do nothing about it.

from contextlib import contextmanager
@contextmanager
def quiet():

sys.stdout = sys.stderr = open(os.devnull, "w")
try:

yield

finally:

sys.stdout = sys.stdout
sys.stderr = sys.stderr

Subtickets (add)

Change History (1)

comment:1 Changed 6 years ago by zhangjr

  • Description modified (diff)
Note: See TracTickets for help on using tickets.