0

I have a launchd that runs a python file using /usr/bin/python3 every 10 seconds. Here is the output of calling launchctl list on my plist:

{
    "LimitLoadToSessionType" = "Aqua";
    "Label" = "com.bob.weather";
    "OnDemand" = false;
    "LastExitStatus" = 256;
    "Program" = "/usr/bin/python3";
    "ProgramArguments" = (
        "/usr/bin/python3";
        "/Users/bob/Dev/OpenTheWindow/weather.py";
    );
};

My code works fine when manually executing.

When I check Console, it says Service exited with abnormal code: 1. It only occurs when I have requests in my imports. The other modules—json and subprocess—can be imported fine. I think it's because requests is installed with pip. What should I do to make requests be recognized?

antoine
  • 29
  • 6
  • Do you get any messages in the `system` log? See e.g. https://stackoverflow.com/a/10712484/874188 – tripleee Jun 21 '21 at 07:47
  • How to fix your `PYTHONPATH` can be explained in the abstract, but it's not going to be very useful -- make sure whichever directory contains the module is included there. For more concrete guidance, please [edit] to show us where `requests` is installed. If you did not simply install it with `sudo pip3 install`, probably also reveal what exactly you did to install it. The simplest fix by far is usually to use a virtual environment. – tripleee Jun 21 '21 at 07:48

0 Answers0