Skip to content

Commit

Permalink
Fix creation of virtual environments
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGrace2282 committed Nov 10, 2024
1 parent 9b66af0 commit 749f76a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 2 additions & 3 deletions scripts/sample_grader.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@

process = subprocess.run(
[sys.executable, sys.argv[1]],
capture_output=True,
stdout=sys.stdout,
stderr=subprocess.STDOUT,
check=False,
)

if process.returncode != 0:
# let the student see the error
print(process.stderr)
print("Score: 0%")
else:
print("Score: 100%")
5 changes: 4 additions & 1 deletion tin/apps/venvs/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
@shared_task
def create_venv(venv_id):
venv = Venv.objects.get(id=venv_id)
python = settings.SUBMISSION_PYTHON
if settings.DEBUG:
python = sys.executable

success = False
try:
Expand All @@ -25,7 +28,7 @@ def create_venv(venv_id):
"-m",
"virtualenv",
"-p",
settings.SUBMISSION_PYTHON,
python,
"--",
venv.path,
],
Expand Down

0 comments on commit 749f76a

Please sign in to comment.