user3114051
user3114051

Reputation: 33

Corrupted python file

By mistake I have corrupted python file.

gauravv@ubuntu:~/Documents$ cp test.py /usr/local/bin/python
cp: cannot create regular file ‘/usr/local/bin/python’: Permission denied
gauravv@ubuntu:~/Documents$ sudo cp test.py /usr/local/bin/python
[sudo] password for gauravv: 
gauravv@ubuntu:~/Documents$

Now I am getting this error

gauravv@ubuntu:/usr/local/bin$ python
bash: /usr/local/bin/python: /usr/local/bin/python: bad interpreter: Too many levels of symbolic links
gauravv@ubuntu:/usr/local/bin$ 

Any way to restore this file w/o installation.

Upvotes: 0

Views: 1673

Answers (1)

NiklasMM
NiklasMM

Reputation: 2972

Depending on your distribution /usr/local/bin/python was probably just a link to the actual binary, which you can definitely restore. All you need to do is find the original binary. Look in places like /usr/bin.

Then restore the link: sudo ln -s /usr/bin/python /usr/local/bin/python

Upvotes: 1

Related Questions