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
  call func from dict mcmxl22 3 486 Jun-21-2019, 05:20 AM
Last Post: snippsat
  About [from FILE import FUNC] Nwb 7 576 Apr-21-2019, 02:46 PM
Last Post: snippsat
  Delete directories in folder is not working after folder is updated asheru93 2 385 Feb-13-2019, 12:37 PM
Last Post: asheru93
  Correct number wrong position func. albry 5 792 Jan-11-2019, 04:01 PM
Last Post: Larz60+
  How can I return my list from a func? Mike Ru 3 755 Oct-22-2018, 01:15 PM
Last Post: buran
  copy content of folder to existing folder shlomi27 0 608 Aug-11-2018, 01:44 PM
Last Post: shlomi27
  list func in lambda mepyyeti 1 1,096 Mar-10-2018, 09:07 PM
Last Post: buran
  return variable in func mepyyeti 1 724 Mar-01-2018, 02:30 AM
Last Post: Larz60+
  Print func textbox instead of shell zykbee 1 1,726 Dec-06-2017, 08:22 PM
Last Post: nilamo
  How to get parent directory from existing func not user func ? harun2525 3 1,935 May-15-2017, 04:47 PM
Last Post: harun2525

Forum Jump:

Users browsing this thread: 1 Guest(s)