Inside the virtual environment, Python Home Assistant can't get the microphone

I have a Python script like this, which I run using the AlexxIT/PyhtonScriptsPro plugin:

import os
os.system('arecord -d 6 -r 48000 -f cd --device plughw:CARD=DeviceEEPROM,DEV=0 /home/pi/recorded.wav')

And in normal terminal mode, it records audio, but when running from HASS, it throws an error:

arecord: main:828: audio open error: No such device  

How i can fix it?