• What does this operator -- means? [Python]
    3 replies, posted
Hello. I have a question regarding Python codes. But first, let me say I suck at this, so please bear with me. I'm using this code in a terminal to execute a python script. python ncs_realtime_objecdetection.py --graph graph --display 1 This code uses a python script, and a file named 'graph' which is in the same directory. But, what does the -- means? -- What do we call it? What does it do exactly? Can we subsitute it with something else? Can we break down the code into its elementary form? I'm trying to execute the code from another python script, using subprocess module. But it just wont work. I think I need to break down the code into its elementary form first. Any help is appreciated. Thank you in advance.
so ignoring the fact that I can almost guarantee you don't actually have the Intel NCS that this script needs to execute the -- is just a arguments indicator. by convention, it's 2 dashes it'll either be sys.argv or a module designed to handle arguments better than the shitshow that is parsing argv manually
For some reason, if I use that whole line of code in the call() command from subprocess modules, nothing happened. Not even an error. Do we need to somehow break the code down, before putting it in the call()? Tldr: -I'm using the Movidius NCS with Picamera for object detection. It run as it should, but on Pi, theres a known problem where the NCS will fail to return the predictions. I can catch the error, restart the usb power to the NCS via code, and restart the NCS, but at later point, even this wouldnt work. I need to restart the whole program. -So I planned to just let the NCS program crashes on its own, while running another python script loop that constantly tries to start that program. So hopefully, when the NCS program crashes, the other program will be avle to restart it. But the code I pasted above just wont work if ita fitted inside call() command. Any idea why? Do we need to separate the call() to the python script from the argument? How would I do that? Any other way?
the issue you're going to run into is IIRC the program can't call sudo without an interactive input but related is the fact that sudo only lasts for so long, so even if you execute your hook checker program as sudo, eventually sudo will time out and then fail to relaunch the script
Sorry, you need to Log In to post a reply to this thread.