walterf25 Expert Licensed User Longtime User Jul 27, 2018 #1 I'm experimenting trying to run some shell scripts and python scripts on my raspberry pi 3. i'am working with a UI application. I've followed several threads i've found in the forums but have not been able to get anything working. For example i have the following code and while i don't get any errors or get any crashes, I can also see the ProcessCompleted sub completing with a success flag but i don't see anything at the output (stdOut). Code: Copy sh.Initialize("sh", "python", Array As String("./ble_log.py") sh.WorkingDirectory = "/home/pi/nrf_shell/input_stream/" 'path where ble_log.py file is located sh.Run(-1) The python scripts basically begins a scan for BLE devices and outputs the device names and Mac-Addresses along with each device's signal strength continously, I know the script works because if I execute it directly from the command line in my raspberry pi i can see all the nearby devices being printed in the console. Is there anything i may be missing, sometimes i also get a pop up window with the error: "Child process could not be started" but i believe this is a different issue. All i need to be able to do is execute the python script and be able to read the output in the processcompleted function. Hope someone can point me in the right direction. Thanks, Walter
I'm experimenting trying to run some shell scripts and python scripts on my raspberry pi 3. i'am working with a UI application. I've followed several threads i've found in the forums but have not been able to get anything working. For example i have the following code and while i don't get any errors or get any crashes, I can also see the ProcessCompleted sub completing with a success flag but i don't see anything at the output (stdOut). Code: Copy sh.Initialize("sh", "python", Array As String("./ble_log.py") sh.WorkingDirectory = "/home/pi/nrf_shell/input_stream/" 'path where ble_log.py file is located sh.Run(-1) The python scripts basically begins a scan for BLE devices and outputs the device names and Mac-Addresses along with each device's signal strength continously, I know the script works because if I execute it directly from the command line in my raspberry pi i can see all the nearby devices being printed in the console. Is there anything i may be missing, sometimes i also get a pop up window with the error: "Child process could not be started" but i believe this is a different issue. All i need to be able to do is execute the python script and be able to read the output in the processcompleted function. Hope someone can point me in the right direction. Thanks, Walter
Erel B4X founder Staff member Licensed User Longtime User Jul 27, 2018 #2 walterf25 said: I can also see the ProcessCompleted sub completing with a success flag but i don't see anything at the output (stdOut) Click to expand... What about StdErr? What happens when you run this command from the terminal? Upvote 0
walterf25 said: I can also see the ProcessCompleted sub completing with a success flag but i don't see anything at the output (stdOut) Click to expand... What about StdErr? What happens when you run this command from the terminal?
walterf25 Expert Licensed User Longtime User Jul 27, 2018 #3 Erel said: What about StdErr? What happens when you run this command from the terminal? Click to expand... I don't get any errors in StdErr, if i run the command from the terminal it works fine, as i mentioned on my post i can see all the nearby devices being logged in the terminal continuously. Walter Upvote 0
Erel said: What about StdErr? What happens when you run this command from the terminal? Click to expand... I don't get any errors in StdErr, if i run the command from the terminal it works fine, as i mentioned on my post i can see all the nearby devices being logged in the terminal continuously. Walter
R Roycefer Well-Known Member Licensed User Longtime User Jul 27, 2018 #4 One possible solution: if your Python script is run with sudo, then your Java app that calls it must also be run with sudo. Upvote 0
One possible solution: if your Python script is run with sudo, then your Java app that calls it must also be run with sudo.
walterf25 Expert Licensed User Longtime User Jul 27, 2018 #5 Roycefer said: One possible solution: if your Python script is run with sudo, then your Java app that calls it must also be run with sudo. Click to expand... I don't think the python script is being called with sudo, but just to test this out, how do i run the java app with sudo? I'm basically running the app through b4j-bridge. Thanks, Walter Upvote 0
Roycefer said: One possible solution: if your Python script is run with sudo, then your Java app that calls it must also be run with sudo. Click to expand... I don't think the python script is being called with sudo, but just to test this out, how do i run the java app with sudo? I'm basically running the app through b4j-bridge. Thanks, Walter
R Roycefer Well-Known Member Licensed User Longtime User Jul 27, 2018 #6 Try starting b4j-bridge with sudo like so: Code: Copy sudo java -jar b4j-bridge.jar Upvote 0
walterf25 Expert Licensed User Longtime User Jul 27, 2018 #7 Roycefer said: Try starting b4j-bridge with sudo like so: Code: Copy sudo java -jar b4j-bridge.jar Click to expand... Ah you mean that, yes I am already doing that, I doubt that's the issue. Walter Upvote 0
Roycefer said: Try starting b4j-bridge with sudo like so: Code: Copy sudo java -jar b4j-bridge.jar Click to expand... Ah you mean that, yes I am already doing that, I doubt that's the issue. Walter
Erel B4X founder Staff member Licensed User Longtime User Jul 29, 2018 #8 Does this example work for you: https://www.b4x.com/android/forum/t...cript-with-parameters-from-b4j.60283/#content ? Upvote 0
Does this example work for you: https://www.b4x.com/android/forum/t...cript-with-parameters-from-b4j.60283/#content ?