Python sys.exec_info() Examples

The following are code examples for showing how to use sys.exec_info(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the exmaples you don't like. You can also save this page to your account.

Example 1
Project: NetPower_TestBed   Author: Vignesh2208   File: emulation_driver.py    (license) View Source Project 6 votes vote down vote up
def trigger(self):

        if self.type == TRAFFIC_FLOW_ONE_SHOT:
            sleep(int(self.offset))
            print "Started command at ", str(datetime.now())
            sys.stdout.flush()
            #os.system(self.cmd + " &")
            try:
                cmd_list = self.cmd.split(' ')
                print cmd_list
                print self.cmd
                sys.stdout.flush()
                p = subprocess.Popen(cmd_list,shell=False)
            except:
                print "Error running command: ", sys.exec_info()[0]

        elif self.type == TRAFFIC_FLOW_EXPONENTIAL:
            pass
        elif self.type == TRAFFIC_FLOW_PERIODIC:
            pass 
Example 2
Project: faceRecognitionforRaspPi   Author: mgudesblatart   File: facerec.py    (license) View Source Project 6 votes vote down vote up
def read_images (path, sz=None):
        c = 0
        X,y = [], []
        for dirname, dirnames, filenames in os.walk(path):
            for subdirname in dirnames:
                subject_path = os.path.join(dirname, subdirname)
                for filename in os.listdir(subject_path):
                    try:
                        if (filename == ".drectory"):
                            continue
                        filepath = os.path.join(subject_path, filename)
                        im = cv2.imread(os.path.join(subject_path, filename), cv2.IMREAD_GRAYSCALE)

                        if (sz is not None):
                                im = cv2.resize(im, sz)
                        X.append(np.asarray(im, dtype=np.uint8))
                        y.append(c)
                    except IOError, (errno, strerror):
                            print "I/O error({0}): {1}".format(errno,strerror)
                    except:
                            print "Unexpected error:", sys.exec_info()[0]
                            raise
                c= c+1
                                        
        return [X,y] 
Example 3
Project: admixturePipeline   Author: smussmann82   File: vcf.py    (license) View Source Project 5 votes vote down vote up
def run_program(self,string):
		print(string)
		try:
			process = subprocess.Popen(string, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
			output, err = process.communicate()
			print(err)
			if process.returncode != 0:
				print("Non-zero exit status:")
				print(process.returncode)
				raise SystemExit
		except:
			print("Unexpected error:")
			print(sys.exec_info())
			raise SystemExit 
Example 4
Project: deb-subunit   Author: openstack   File: __init__.py    (license) View Source Project 5 votes vote down vote up
def _handleTime(self, offset, line):
        # Accept it, but do not do anything with it yet.
        try:
            event_time = iso8601.parse_date(line[offset:-1])
        except TypeError:
            raise TypeError(_u("Failed to parse %r, got %r")
                % (line, sys.exec_info[1]))
        self.client.time(event_time)