First of all, this is my second time writing code. It is supposed to insert a number provided by the user (in the Alfred dialog) into a predefined cell in a predefined Excel sheet. The code worked when I ran it in Terminal (python 3.7) and on Anaconda (python 3.7). When I tried running it in Terminal on usr/bin/python (python 2.7) it couldn't import the module/library (https://pypi.org/project/openpyxl/). However, I thought by downloading the package, moving it to the workflow's local folder, and running it on Alfred the issue will be solved. It didn't work and I received this error on debugging (replacing the path seen in the 4th line with PATH in the rest of the lines):
This is the code:
#!/usr/bin/python
# encoding: utf-8
import sys
import os
from workflow import Workflow
from workflow import Variables
from openpyxl import load_workbook
v = os.getenv('questions')
path = '/Users/Yaz/Desktop/Schedule.xlsx'
wb = load_workbook(filename = path)
sheet = wb['Sheet1']
sheet['I1'].value = v
wb.save(path)
The workflow starts with a "Keyword" object that requires an argument (the number) connected to an "Arg and Vars" ,which assigns the name "questions" to the {query}, connected to a "Run Script" action (/bin/bash) with "/usr/bin/python excel.py "{var:questions}" as the script.
I have Alfred 4.1 running on macOS Mojave.