Skip to content
Snippets Groups Projects
Commit 49cf1d36 authored by Thomas Kluyver's avatar Thomas Kluyver
Browse files

Use subprocess.DEVNULL for output redirection

parent 9dcd5b33
No related branches found
No related tags found
1 merge request!331Some cleanup in calibrate.py
...@@ -11,7 +11,7 @@ from nbparameterise import ( ...@@ -11,7 +11,7 @@ from nbparameterise import (
import os import os
import pprint import pprint
import re import re
from subprocess import check_output from subprocess import check_output, DEVNULL
import sys import sys
import warnings import warnings
from .settings import * from .settings import *
...@@ -163,11 +163,9 @@ def extract_title_author_version(nb): ...@@ -163,11 +163,9 @@ def extract_title_author_version(nb):
# in the _version.py file # in the _version.py file
try: try:
git_dir = os.path.join(PKG_DIR, '..', '.git') git_dir = os.path.join(PKG_DIR, '..', '.git')
FNULL = open(os.devnull, 'w') version = check_output([
version = check_output(['git', 'git', f'--git-dir={git_dir}', 'describe', '--tag',
'--git-dir={}'.format(git_dir), ], stderr=DEVNULL).decode('utf8')
'describe', '--tag'],
stderr=FNULL).decode('utf8')
version = version.replace("\n", "") version = version.replace("\n", "")
except: except:
from .VERSION import __version__ from .VERSION import __version__
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment