Skip to content

Commit f280273

Browse files
committed
change os.system to subprocess.run
1 parent 9720d4b commit f280273

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

python150k/preprocess.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from ast_conversion import get_dfs, convert
99
from io import BytesIO
1010
from processor_ast import Preprocess
11+
from subprocess import DEVNULL, STDOUT, run
1112
from typing import Tuple, List
1213

1314
import json
@@ -176,7 +177,9 @@ def collect_data(filename: str,
176177
global error_counter
177178

178179
# Convert Python 2 to Python 3
179-
os.system(f"~/.conda/envs/scs/bin/2to3 {filename} -w -n")
180+
# os.system(f"~/anaconda3/envs/scs/bin/2to3 {filename} -w -n")
181+
run(["/home/masaidov/.conda/envs/scs/bin/2to3", filename, "-w", "-n"],
182+
stdout=DEVNULL, stderr=STDOUT)
180183
print("Building AST tree from a filename:", filename)
181184

182185
code = read_file_to_string(filename)

0 commit comments

Comments
 (0)