Skip to content
Snippets Groups Projects
Commit bfd6aefe authored by tuhe's avatar tuhe
Browse files

Robust approach to python executable for virtual environments

parent 8af33d05
No related branches found
No related tags found
No related merge requests found
Metadata-Version: 2.1 Metadata-Version: 2.1
Name: codesnipper Name: codesnipper
Version: 0.1.18.5 Version: 0.1.18.6
Summary: A lightweight framework for censoring student solutions files and extracting code + output Summary: A lightweight framework for censoring student solutions files and extracting code + output
Home-page: https://lab.compute.dtu.dk/tuhe/snipper Home-page: https://lab.compute.dtu.dk/tuhe/snipper
Author: Tue Herlau Author: Tue Herlau
......
...@@ -2,6 +2,8 @@ import functools ...@@ -2,6 +2,8 @@ import functools
import textwrap import textwrap
from snipper.legacy import block_process from snipper.legacy import block_process
from snipper.block_parsing import full_strip from snipper.block_parsing import full_strip
import sys
import os import os
if os.name == 'nt': if os.name == 'nt':
import wexpect as we import wexpect as we
...@@ -22,7 +24,7 @@ def rsession(analyzer, lines, extra): ...@@ -22,7 +24,7 @@ def rsession(analyzer, lines, extra):
print(k['output']) print(k['output'])
import time import time
an = we.spawn("python", encoding="utf-8", timeout=20) an = we.spawn(sys.executable, encoding="utf-8", timeout=20)
try: try:
an.setwinsize(400, 400) # set window size to avoid truncated output or input. an.setwinsize(400, 400) # set window size to avoid truncated output or input.
except AttributeError as e: except AttributeError as e:
...@@ -133,7 +135,7 @@ def run_i(lines, file, output): ...@@ -133,7 +135,7 @@ def run_i(lines, file, output):
# an.setecho(True) # TH January 2023: Seems to fix an issue on linux with truncated lines. May cause problems on windows? # an.setecho(True) # TH January 2023: Seems to fix an issue on linux with truncated lines. May cause problems on windows?
if extra['python'] is None: if extra['python'] is None:
an = we.spawn("python", encoding="utf-8", timeout=20) an = we.spawn(sys.executable, encoding="utf-8", timeout=20)
try: try:
an.setwinsize(400, 400) # set window size to avoid truncated output or input. an.setwinsize(400, 400) # set window size to avoid truncated output or input.
except AttributeError as e: except AttributeError as e:
......
__version__ = "0.1.18.5" __version__ = "0.1.18.6"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment