![]() |
I want to search a variable for a string D90 - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: I want to search a variable for a string D90 (/thread-33101.html) |
I want to search a variable for a string D90 - lostbit - Mar-29-2021 Very sorry to post such a basic question, I have been reading and trying so many things with no luck. Platform is rasberry PI 4 running astroberry OS build. Python version 2.7.16 The camera did not respond, returncode=0. Question here is, I need an if statement that will interrupt the code if return is 0, how do I use the returncode, or parse check_camera is it 0 or 1. Thank You # Controll my Nikon D90 with GPIO #2 import logging import RPi.GPIO as GPIO import time import os import subprocess import sh import sys from sh import gphoto2 as gp #run a test to confirm camera is communicating check_camera = subprocess.run(["gphoto2", "--auto-detect"]), time.sleep(.5) #print("stdout:", result.stdout) #print("stderr:", result.stderr) print (check_camera) (CompletedProcess(args=['gphoto2','--auto-detect'] returncode=0),) RE: I want to search a variable for a string D90 - Larz60+ - Mar-29-2021 Quote:Python version 2.7.16This version of python has been obsolete since Jan 1, 2020. RE: I want to search a variable for a string D90 - lostbit - Mar-31-2021 (Mar-29-2021, 09:40 PM)Larz60+ Wrote:Quote:Python version 2.7.16This version of python has been obsolete since Jan 1, 2020. RE: I want to search a variable for a string D90 - lostbit - Mar-31-2021 Thank your for input, despite warnings not to upgrade python I have found so many help topics for version 3.5 and newer that I now see newly added commands might be my best bet. |