Play random mp3 from usb (phyton script)

Tags: #<Tag:0x00007fc410875038>

Hi everybody.
I need to play mp3 from ubs stick.
In fact I would like to have 2 commands:
phyton_script.play_random_mp3
phyton_script.stop_payling_mp3

I found an example for “play_random_mp3”:

#!/usr/bin/env python
import os
import random

def rndmp3 ():
    randomfile = random.choice(os.listdir('/media/usb/'))
    file = '/media/usb/'+ randomfile
    os.system ('omxplayer -o local ' + file)

rndmp3 ()

and it works, if I just execute it in command line:
python play_random_mp3.py

But if I start it in HA, like "phyton_script.play_random_mp3" I get following error:

Error executing script: __import__ not found
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/python_script/__init__.py", line 166, in execute
    exec(compiled.code, restricted_globals, local)
  File "random_ubs_mp3.py", line 2, in <module>
ImportError: __import__ not found

Does anybody have an idea?

Well, looks like python_script component doesn’t support import in Homeassistant