0

Good day. I am using a repl server with Python 3.1.1. I am on Linux. I am aware of

TERM environment variable not set

However, when I do put set | grep TERM or export TERM=xterm, it says

Traceback (most recent call last):
  File "python", line 75
    set | grep TERM
                  ^
SyntaxError: invalid syntax

I also want to clear my shell window.

UPDATE: My screen clearing code is from:

how to clear the screen in python

Any help is appreciated! Thanks.

Arihan Sharma
  • 133
  • 1
  • 13

1 Answers1

2

You are trying to run bash code inside python, which is invalid syntax.

To achieve the same effect try

import os
os.environ.get('TERM', '')

To set an environment variable from python try

import os
os.environ['TERM'] = 'xterm'

But ideally set that from bash.

Andrei Cioara
  • 3,404
  • 5
  • 34
  • 62