Aspak Rogatiya
Aspak Rogatiya

Reputation: 169

In python interpreter, os.system() always returns -1

When I tried to clear the python shell with using following python commands.

import os
os.system("cls")

It always returned -1. Then I tried os.system() for different inputs. like,

os.system("cd ..")
os.system("mkdir hello")

But it fails all the time and returns -1. Why is it so?

Upvotes: 1

Views: 424

Answers (1)

Aspak Rogatiya
Aspak Rogatiya

Reputation: 169

I found a solution for this problem. I am posting the solution if someone faces the same problem in future.

In my case, environment variable ComSpec was modified automatically by Microsoft SQL server update. I did modify it to the previous value, that was "%SystemRoot%\system32\cmd.exe". After modifying this environment variable, logoff and login again.

Upvotes: 1

Related Questions