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
  MySQL executemany - Failed executing the operation; Could not process parameters josh_marchant 1 43 May-16-2019, 04:22 PM
Last Post: woooee
  Read a folder with a multiple files NewBeie 7 141 May-06-2019, 08:04 AM
Last Post: NewBeie
  folder PyQt5 created during creation exe atlass218 0 71 Apr-26-2019, 06:25 PM
Last Post: atlass218
  About [from FILE import FUNC] Nwb 7 192 Apr-21-2019, 02:46 PM
Last Post: snippsat
  if /else statement not executing correctly bluethundr 3 133 Apr-15-2019, 10:20 PM
Last Post: bluethundr
  Problem with executing 2 .py files PardodeCela 1 115 Apr-11-2019, 07:07 PM
Last Post: Gribouillis
  Smartsheet api data using python into folder dspy9 0 89 Apr-04-2019, 07:30 PM
Last Post: dspy9
  Including classes from folder issue graham23s 1 126 Apr-03-2019, 07:33 AM
Last Post: Gribouillis
  file.write stops while true loop from executing in python3 boonr 3 148 Mar-25-2019, 12:50 PM
Last Post: ichabod801
  Problems parsing /proc folder anddontyoucomebacknomore 2 168 Mar-06-2019, 09:16 PM
Last Post: DeaD_EyE

Forum Jump:

Users browsing this thread: 1 Guest(s)