Cool stuff for Raspberry Pi, Arduino and all electronics hobby projects
Notifications
Clear all

[Solved / Archived] Witty Pi 4: AfterStartup.sh script

3 Posts
2 Users
0 Likes
517 Views
(@cesar)
Posts: 5
Active Member
Topic starter
 

Hello, I'm trying to run a python file from "afterStartup.sh". I can show in the witty.log that it's executed but my python application returns a "ModuleNotFound" error. The python file imports other file and this imports some libraries, and these libraries are not found.

If I run the python script from the console, it works. If I run the afterStartup.sh file, it works!

So I don't know why it doesn't work when the "afterstartup.sh" runs automatically, maybe permissions or something related with the PATH or the python environments? I'm not so expert in python, sorry.

Thanks for your help.

 
Posted : 26/06/2023 2:27 pm
(@admin)
Posts: 477
Member Admin
 

I believe it is related to the path.

The afterStartup.sh is run by daemon.sh, which is run with root user. As root user those paths you rely on are missing. You may need to specify aboslute path for every file you referred.

 

 
Posted : 26/06/2023 3:26 pm
(@cesar)
Posts: 5
Active Member
Topic starter
 

Ok thanks. I used an environment and it's working.

 
Posted : 29/06/2023 2:32 pm
Join Waitlist We will inform you when the product arrives in stock. Please leave your valid email address below.