I have a code which is written in python3. I get an error when the scheduled task tries to run my script. The log says that the error came from trying to import websocket.
When I try to run a simple script to find out what is going wrong, I get the same error. The code is below. It simply saves the current time to a .csv file every 15 seconds.
timeprint.py
import csv
import time
import websocket
def saveTime():
while True:
with open('longprint.csv', 'a') as myFile:
csv.writer(myFile, delimiter = ',').writerow([int(time.time())])
time.sleep(15)
log
Traceback (most recent call last):
File "timeprint.py", line 3, in <module>
import websocket
ModuleNotFoundError: No module named 'websocket'
My specific code is written in python3 and therefore can't be executed in python2. Also when I try to run it in python3.3 or python3.6, I get the same error.
(I already installed "pip install websocket --user")
Any ideas to why this happening?