Bottom Page

Thread Rating:
  • 2 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Executing func() from a different folder

I've a containing a func(x) in my /home/pi directory.

I need to execute the func(x) from /var/www/html directory with the code "python3 test 0". Said code works within the pi directory but not from outside of it.

I've given the www-data group permissinon to but cannot solve the path '/home/pi' issue.

Any help is appreciated.
You like this post
Did you also give permissions for the /home/pi directory?

Also do you need to run it exactly with this line?
python3 test 0
You should specify the path:
python3 /home/pi/ 0
You like this post
Thanks. Not sure if it's the right way but I solved my issue by creating a local file point to the original located in a different folder as such:

#!/usr/bin/env python

import sys
sys.path.insert(0, '/home/pi/.')

from gpio import ledsOn

if __name__ == '__main__':
  n = int(sys.argv[1])
You like this post

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  file.write stops while true loop from executing in python3 boonr 3 52 7 hours ago
Last Post: ichabod801
  Problems parsing /proc folder anddontyoucomebacknomore 2 122 Mar-06-2019, 09:16 PM
Last Post: DeaD_EyE
  Executing python script from SQL Server agent job getting error msavoy 1 119 Feb-15-2019, 08:37 PM
Last Post: Larz60+
  Accessing Files In A Folder asilverg 1 92 Feb-15-2019, 08:08 AM
Last Post: buran
  Delete directories in folder is not working after folder is updated asheru93 2 92 Feb-13-2019, 12:37 PM
Last Post: asheru93
  Error executing Jupyter command 'notebook': [Errno 'jupyter-notebook' not found] 2 Newtopython123 8 8,236 Feb-09-2019, 02:05 PM
Last Post: rudtj5592
  Correct number wrong position func. albry 5 270 Jan-11-2019, 04:01 PM
Last Post: Larz60+
  Error when executing pytesseract to get the text from image bvdinesh 2 440 Jan-06-2019, 05:28 AM
Last Post: bvdinesh
  if-elif-else statement not executing laila1a 4 185 Jan-05-2019, 02:22 PM
Last Post: buran
  Executing 2 lines at the same time SheeppOSU 2 198 Dec-22-2018, 05:16 AM
Last Post: Gribouillis

Forum Jump:

Users browsing this thread: 1 Guest(s)