Here's a Python script that outputs 'python', 'c++', 'java', or 'javascript' randomly based on the given ratios:

```python
import random

languages = ['python'] * 10 + ['c++'] * 5 + ['java'] * 5 + ['javascript'] * 2
random.shuffle(languages)

print(languages[0])
```

Explanation:

1. We import the `random` module to randomly shuffle the `languages` list.
2. We create the `languages` list with the desired ratios. For example, we use `'python' * 10` to create 10 instances of `'python'` in the list.
3. We use `random.shuffle()` to shuffle the `languages` list randomly.
4. We print the first element of the shuffled `languages` list, which will be randomly selected based on the ratios.
Write a python script that outputs randomly 'python', 'c++', 'java' or 'javascript' in ratio [10, 5, 5, 2]