#13 closed defect (wontfix)
import quietly
Reported by: | zhangjr | Owned by: | zhangjr |
---|---|---|---|
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
Change History (7)
comment:1 Changed 5 years ago by zhangjr
- Description modified (diff)
comment:2 Changed 5 years ago by zhangjr
- Owner changed from somebody to zhangjr
- Status changed from new to accepted
comment:3 Changed 5 years ago by zhangjr
comment:4 Changed 5 years ago by zhangjr
export PYTHONWARNINGS="ignore"
comment:5 Changed 5 years ago by zhangjr
import sys
import warnings
if not sys.warnoptions:
warnings.simplefilter("ignore")
comment:6 Changed 5 years ago by zhangjr
- Resolution set to wontfix
- Status changed from accepted to closed
comment:7 Changed 5 years ago by zhangjr
it looks no solution.
Note: See
TracTickets for help on using
tickets.
python -W ignore wsgi.py