当前位置: 首页>>代码示例>>Python>>正文


Python sys.exec_info函数代码示例

本文整理汇总了Python中sys.exec_info函数的典型用法代码示例。如果您正苦于以下问题:Python exec_info函数的具体用法?Python exec_info怎么用?Python exec_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了exec_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: reboot

 def reboot(self, id):
     """Reboot the instance."""
     dbaas = common.get_client()
     try:
         result = dbaas.management.reboot(id)
     except:
         print sys.exec_info()[1]
开发者ID:vipulsabhaya,项目名称:python-reddwarfclient,代码行数:7,代码来源:mcli.py

示例2: getAll

def getAll(IP=''):
    global myCursor, myConnection
    opType = "GET_ALL"
    allData = []
    count = 0
    retFlag = -1
    if not myCursor:
        startConnection()
    value = ''
    try:
        sqlSmt = "SELECT * FROM " + DBTABLE
        #msg(0, opType, "SQL: " + sqlSmt, IP)
        for row in myCursor.execute(sqlSmt):
            allData.append((row[0], row[1]))
            count = count + 1
        msg(0, opType, str(count) + " row(s) fetched", IP)
        if count == 0:
            retFlag = 1
        else:
            retFlag = 0
    except:
        retFlag = -1
        print sys.exec_info()
        msg(1, opType, "getting all key-value pairs failed!")
    return retFlag, count, allData
开发者ID:jferiante,项目名称:Python-Key-Value-Store,代码行数:25,代码来源:dbWorkers.py

示例3: server

def server(listen_port):
    try:
        r.start_server(listen_port)
        stdin_thread = threading.Thread(target=stdin_listener, args=())
        stdin_thread.start()
        while True:
            # Server loop
            curr_time = time.time()
            for activity in activity_tracker:
                if curr_time - activity_tracker[activity] > 3600:
                    # Clean database of hosts with activity more than one hour ago.
                    with stdout_lock:
                        print("Remove host from database: {}".format(activity[0]))
                    database_remove_host(activity[0])
            try:
                message = r.receive_data()
                process_message(message)
            except queue.Empty:
                continue
            except:
                with stdout_lock:
                    print("Unexpected error:", sys.exec_info()[0])
    except KeyboardInterrupt:
        with stdout_lock:
            print("Goodbye!")
    except:
        with stdout_lock:
            print("Unexpected error:", sys.exec_info()[0])
    finally:
        r.close()
        os._exit(1)
开发者ID:mplang,项目名称:p2p,代码行数:31,代码来源:server.py

示例4: ANMIvrForOverdueServices_Exotel

def ANMIvrForOverdueServices_Exotel(mode=1, target=1):
    #mode = 1 Due
    #mode = 2 OverDue
    #mode = 3 Both
    if target == 1:
        benef_type = ANCBenef
    elif target == 2:
        benef_type = IMMBenef

    timezone = 'Asia/Kolkata'
    tz = pytz.timezone(timezone)
    today = utcnow_aware().replace(tzinfo=tz)
    date_then = today.replace(hour=12, minute=0, day=1, second=0).date()
    from sms.sender import SendVoiceCall

    #Voice call for ANC
    if mode == 1:
        benefs = benef_type.objects.filter(due_events__date=date_then).distinct()
    elif mode ==2:
        benefs = benef_type.objects.filter(odue_events__date=date_then).distinct()
    else:
        abenefs = benef_type.objects.filter(odue_events__date=date_then).distinct() & ANCBenef.objects.filter(due_events__date=date_then).distinct()
    anms = CareProvider.objects.filter(beneficiaries__in=benefs).distinct()
    
    callerid = ""
    app_url = settings.EXOTEL_APP_URL
    for anm in amns:
        try:
            connect_customer_to_app(customer_no=due_anms.notify_number, callerid=callerid, app_url=app_url)
        except:
            sys.exec_info()[0]
开发者ID:komaliitm,项目名称:Patedu,代码行数:31,代码来源:utils.py

示例5: receieData

def receieData(s):
	data = ""
	try:
		data = s.recvfrom(65565)
	except timeout:
		data = ""
	except:
		print("an error occured")
		sys.exec_info()
	return data[0]
开发者ID:Artemijs,项目名称:WorkBench,代码行数:10,代码来源:steal.py

示例6: transfer

 def transfer(self, filename, servername, remotedir, userinfo):
     try:
         self.do_transfer(filename, servername, remotedir, userinfo)
         print("%s of %s successful" % (self.mode, filename))
     except:
         print("%s of %s has failed" % (self.mode, filename), end=" ")
         print(sys.exec_info()[0], sys.exec_info()[1])
     self.mutex.acquire()
     self.threads -= 1
     self.mutex.release()
开发者ID:abrarisme,项目名称:RandomPyCode,代码行数:10,代码来源:getfilegui.py

示例7: sendSuccess

 def sendSuccess(self, resp, command, data, prepend=None):
     logger.debug("SUCCESS! "+command+":"+data)
     #logger.debug("response: '%s'" % (resp,))
     if prepend:
         w = "%s:%s %s:%s\r\n" % (prepend, command, fencode(resp), data)
     else:
         w = "%s:%s:%s\r\n" % (command, fencode(resp), data)
     self.transport.write(w)
     self.commands[command][CONCURR] -= 1
     try:
         self.serviceQueue(command)
     except:
         print sys.exec_info()
     return resp
开发者ID:alenpeacock,项目名称:flud,代码行数:14,代码来源:LocalPrimitives.py

示例8: ReadWebContent

def ReadWebContent(UrlLink):

    try:

        ContentObj = urllib2.urlopen(UrlLink, timeout=120)

        WebContent = ContentObj.read()
    except:

        print 'Unable to open ' + UrlLink
        print sys.exec_info()
        WebContent = ''

    return WebContent
开发者ID:tijcolem,项目名称:program-samples,代码行数:14,代码来源:IngestDataMesowest.py

示例9: convertvideo

def convertvideo(video):
    if video is None:
        return "Kein Video im Upload gefunden"
    filename = video.videoupload
    print "Konvertiere Quelldatei: %s" + filename
    if filename is None:
        return "Video mit unbekanntem Dateinamen"
    sourcefile = "%s%s" % (settings.MEDIA_ROOT, filename)
    flvfilename = "%s.flv" % video.id
    thumbnailfilename = "%svideos/flv/%s.png" % (settings.MEDIA_ROOT, video.id)
    targetfile = "%svideos/flv/%s" % (settings.MEDIA_ROOT, flvfilename)
    ffmpeg = "ffmpeg -y -i %s -acodec mp3 -ar 22050 -ab 32 -f flv -s 320x240 %s" % (sourcefile, thumbnailfilename)
    grabimage = "ffmpeg -y -i %s -vframs 1 -ss 00:00:02 -an -vcodec png -f rawvideo -s 320x240 %s" % (sourcefile, thumbnailfilename)
    flvtool = "flvtool2 -U %s" % targetfile
    print ("Source: %s" % sourcefile)
    print ("Target: %s" % targetfile)
    print ("FFMPEG: %s" % ffmpeg)
    print ("FLVTOOL: %s" % flvtool)
    try:
        ffmpegresult = commands.getoutput(ffmpeg)
        print "-----------------FFMPEG------------------"
        print ffmpegresult
        # Check if file exists and is > 0 Bytes
        try:
            s = os.stat (targetfile)
            print s
            fsize = s.st_size
            if (fsize == 0):
                print "File is 0 Bytes gross"
                os.remove (targetfile)
                return ffmpegresult
            print "Dateigroesse ist %i" %fsize
        except:
            print sys.exec_info()
            print "File %s scheint nicht zu existieren" % targetfile
            return ffmpegresult
        flvresult = commands.getoutput(flvtool)
        print "--------------FLVTOOL----------------"
        print flvresult
        grab = commands.getoutput (grabimage)
        print "--------------GRAB IMAGE----------------"
        print grab
    except:
        print sys.exec_info()
        return sys.exec_info[1]
    video.flvfilename = flvfilename
    video.save()
    return None
            
开发者ID:nilvon9wo,项目名称:HodgeBlodge,代码行数:48,代码来源:helpers.py

示例10: status_wifite

def status_wifite(sWhat,sValue):
    if 'rab' in aToDisplay:
        del aToDisplay['rab']
    if sWhat=='Cracked':
        try:
            # sValue is the AP's ssid
            sKey=str(client.read('/cracked/from_reboot/'+sValue).value)
        except KeyError:
            print 'No key for AP "'+sValue+'"'
        except:
            print 'Unexpected error:',sys.exec_info()[0]
        else:
            lcd.backlight(ON)
            aToDisplay[sValue]=">"+sValue+':'+sKey+"\n"
            if 'wifite' in aToDisplay:
                del aToDisplay['wifite']
    elif sWhat == 'Attacking':
        aToDisplay['wifite']="Attacking:\n"+sValue+"\n"
    elif sWhat == 'Start cracking':
        aWStatus=string.split(str(client.read('/wifite/status').value),':')
        aToDisplay['wifite']="Cracking:\n"+sValue+"\n"+aWStatus[1]+"\n"
    else:
        # Wifite status
        aToDisplay['wifite']=sValue+"\n"
    return aToDisplay
开发者ID:Korsani,项目名称:airberry,代码行数:25,代码来源:airberryd.py

示例11: write_raw

	def write_raw(self):
		try:
			""" writes each condition in the rawFile in the following format
				Filename(line x):
					Condition: condition text
					Type: type of condition(IF,WHILE ...)
					#Branches: Number of branches in condition
					Multicond: 0 - not a part of a multiple condition
							   1 - a part of a multiple condition
					Expected: 0 - contition is EXPECTED to happend
							  1 - condition is UNEXPECTED to happend
							  2 - unknown expectation
					Branches:
							# : branch name - probability% (x times executed)
			"""
			for cond in self.execConditions :
				out = cond.to_string()
				self.rawFile.write(out)

			self.rawFile.write("\n\n---- Never Executed ----\n\n")
			for cond in self.neverConditions :
				out = cond.to_string()
				self.rawFile.write(out)
		except:
			print "Unexpected file writing error:",sys.exec_info()[0]
			raise

		try:
			self.rawFile.close()
		except:
			print "Error on closing file"
			raise
开发者ID:01org,项目名称:branch_hinting_tool,代码行数:32,代码来源:generate_csv.py

示例12: create_log_files

	def create_log_files(self):
		try:
			self.csvFile = open(self.csvFilename, 'w')
			self.rawFile = open(self.rawFilename, 'w')
		except:
			print "Unexpected file opening error:",sys.exec_info()[0]
			raise
开发者ID:01org,项目名称:branch_hinting_tool,代码行数:7,代码来源:generate_csv.py

示例13: copy_lldbpy_file_to_lldb_pkg_dir

def copy_lldbpy_file_to_lldb_pkg_dir( vDictArgs, vstrFrameworkPythonDir, vstrCfgBldDir ):
	dbg = utilsDebug.CDebugFnVerbose( "Python script copy_lldbpy_file_to_lldb_pkg_dir()" );
	bOk = True;
	bDbg = vDictArgs.has_key( "-d" );
	strMsg = "";
	
	strSrc = vstrCfgBldDir + "/lldb.py";
	strSrc = os.path.normcase( strSrc );
	strDst = vstrFrameworkPythonDir + "/__init__.py";
	strDst = os.path.normcase( strDst );
	
	if not os.path.exists( strSrc ):
		strMsg = strErrMsgLLDBPyFileNotNotFound % strSrc;
		return (bOk, strMsg);
	
	try:
		if bDbg:
			print(strMsgCopyLLDBPy % (strSrc, strDst));
		shutil.copyfile( strSrc, strDst );
	except IOError as e:
		bOk = False;
		strMsg = "I/O error( %d ): %s %s" % (e.errno, e.strerror, strErrMsgCpLldbpy);
		if e.errno == 2:
			strMsg += " Src:'%s' Dst:'%s'" % (strSrc, strDst);
	except:
		bOk = False;
		strMsg = strErrMsgUnexpected % sys.exec_info()[ 0 ];
	
	return (bOk, strMsg);
开发者ID:johndpope,项目名称:lldb,代码行数:29,代码来源:finishSwigPythonLLDB.py

示例14: ftp_down

def ftp_down(oftp, fd_save, range_start, range_end, n_thread):
    ''' thread function: create ftp data connections, download FTP target with REST and RETR request '''

    try:
        fd_ftp = ftp_connect_login(oftp)

        fd_ftp.voidcmd('TYPE I')
        fd_ftp.sendcmd('REST %s' % range_start)
        fd_ftpdata = fd_ftp.transfercmd(
            'RETR %s' % oftp.ftp_path)  # ftp data fd

        offset = range_start
        while offset < range_end + 1:
            if offset > range_end + 1 - BUFFSIZE:
                content_block = fd_ftpdata.recv(range_end + 1 - offset)
            else:
                content_block = fd_ftpdata.recv(BUFFSIZE)
            global rlock_file
            with rlock_file:
                fd_save.seek(offset)
                fd_save.write(content_block)
                global size_down
                size_down += len(content_block)
                # print "Thread %d piece %d done: %d-%d" % (n_thread, i, offset,
                # offset+len(content_block)-1)
            offset += len(content_block)
        print "Thread %d all done: %d-%d" % (n_thread, range_start, range_end)

        fd_ftpdata.close()
        ftp_disconnect(fd_ftp)
        return 0
    except Exception as error:
        print error
        return traceback.format_exception(sys.exec_info())
开发者ID:hurdonkey,项目名称:http_ftp_thread,代码行数:34,代码来源:HttpFtpDownloader.py

示例15: report_event_api

def report_event_api(request):
    if not request.method == 'POST':
        return HttpResponse('{} Not Allowed'.format(request.method), status=405)
    
    print('Started view.')
    device = request.POST.get('device', '')
    event_type = request.POST.get('type', '')
    region_id = request.POST.get('region', None)
    event = models.FishingEvent(device=device, event_type=event_type, region_id=region_id, timestamp=now())
    # Optional stuff
    event.latitude = request.POST.get('latitude', None)
    event.longitude = request.POST.get('longitude', None)
    event.species = request.POST.get('species', None)
    event.size = request.POST.get('size', '')
    event.weight = request.POST.get('weight', '')
    event.notes = request.POST.get('notes', '')
    print('Built Event.')

    try:
        event.save()
    except Exception as ex:
        print(sys.exec_info())
        return HttpResponse('Data was missing or improperly formatted.', status=400)

    print('Saved Event.')

    return event_detail_api(request, event.pk)
开发者ID:Gregory-Phillips,项目名称:fishackathon2015,代码行数:27,代码来源:views.py


注:本文中的sys.exec_info函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。