Python Forum
ModuleNotFoundError only if script is launched by cron
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ModuleNotFoundError only if script is launched by cron
#2
Possibly your login environment has a PATH that points to one version of python and CRON is using the default system path that points to a different installation of python.

lancement.sh runs the python specified in the environment (the path) and that might be different between root and the "pi" account.

Try doing sudo su - and then try to run the script. Does it fail?
Reply


Messages In This Thread
RE: ModuleNotFoundError only if script is launched by cron - by bowlofred - Feb-03-2022, 06:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED] [Linux] Script in cron stops after first run in loop Winfried 2 1,011 Nov-16-2022, 07:58 PM
Last Post: Winfried
  script with imports works but pytest gives "ModuleNotFoundError"? Hpao 0 1,629 Jun-27-2021, 08:30 PM
Last Post: Hpao
  Python Script Spawned by Cron or Systemd doesn't write files..? johnnyrobot 2 2,667 May-24-2019, 07:04 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020