Hi,
I am trying to run the following python script (located in /scripts/ of the folder containing default.yml):
import time
number = int(time.time())
base36 = ''
alphabet = "0123456789abcdefghijklmnopqrstuvwxyz"
if number < len(alphabet):
base36 = alphabet[number]
else:
while number != 0:
number, i = divmod(number, len(alphabet))
base36 = alphabet[i] + base36
print(base36)
With the following command:
- trigger: ":pyscript"
replace: "{{output}}"
vars:
- name: "output"
type: script
params:
args:
- python
- "%CONFIG%/scripts/time2base36.py"
But espanso returns a blank space. What am I doing wrong?
(I tried it first with bash script and had the same issue as I asked on Reddit a few hours ago. I blamed my bash-illiteracy though 馃槃, and tried it in Python.)
In my case all working, try this.
- trigger: ":test"
replace: "{{output}}"
vars:
- name: output
type: shell
params:
cmd: "python /home/hammer/Documents/_HOME/dry-python-bot/2.py"
Hey @psyguy,
Your program should work at this point, so that's strange. A couple of things you could try:
python interpreterespanso log to check the error message.Cheers :)
The error log read:
13:32:04 [ WARN] Shell command reported error:
python : The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
The issue was solved by adding the full path to the python interpreter.
Thanks @Hammer2900 and @federico-terzi 馃檭.