Python pty.spawn not working

I was using a bash shell, but I tried both for the sake of being thorough. I’m not even following the walkthrough necessarily in order to exploit the machine. The only reason I pulled it up in the first place was because my shell upgrade wasn’t working and I wanted to double check that I wasn’t doing anything wrong. However we both get a shell via nc, and running the code on the machine, then his upgrade works and mine doesnt. So I’m just at a loss.