I have made a scheduled programme on the osx system and I am trying to run it in the background, I read a different question about it and it said that this should work in the terminal by using this command, I have also tried downloading the modules as a root, nothing changed:
python /Users/teddy/Desktop/herumblödeln/main.py &
But the terminal returns an error:
teddy@Teddys-MBP ~ % Traceback (most recent call last):
  File "/Users/teddy/Desktop/herumblödeln/main.py", line 1, in <module>
    import schedule
ImportError: No module named schedule
Why does this happen?
My code looks like this:
import time import schedule import docx from pync import Notifier import tkinter as tk from tkinter import simpledialog
Running pip freeze returns
teddy@Teddys-MBP ~ % pip freeze asteval==0.9.27 cycler==0.11.0 et-xmlfile==1.1.0 fonttools==4.28.3 future==0.18.2 imageio==2.19.5 kiwisolver==1.3.2 lmfit==1.0.3 lxml==4.9.1 matplotlib==3.5.1 mpmath==1.2.1 networkx==2.8.5 numpy==1.21.4 openpyxl==3.0.10 packaging==21.3 pandas==1.4.3 Pillow==8.4.0 plyer==2.0.0 pync==2.0.3 pyparsing==3.0.6 python-dateutil==2.8.2 python-docx==0.8.11 pytz==2022.1 PyWavelets==1.3.0 schedule==1.1.0 scikit-image==0.19.3 scipy==1.8.1 six==1.16.0 sympy==1.10.1 tifffile==2022.5.4 uncertainties==3.1.7 XlsxWriter==3.0.3
Results from pip -V and python -V
teddy@Teddys-MBP ~ % pip -V pip 22.2.2 from /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip (python 3.10) teddy@Teddys-MBP ~ % python -V Python 2.7.18
Advertisement
Answer
In your terminal run pip install schedule, your output message should be like Requirement already satisfied because you have it installed already, just that you are in a different venv.
Now, before Requirement already satisfied message you will find a path, copy that that path.
Now go to your main.py because that is where the error is found. Before import schedule you should import sys.  E,g:
import sys
sys.path.append("/past/the/path/you/copied/here")
import schedule
