示例#1
0
文件: __main__.py 项目: grg2rsr/ILTIS
    def loadFile(self, edited=False):

        extra = []
        qtLib = str(self.ui.qtLibCombo.currentText())
        gfxSys = str(self.ui.graphicsSystemCombo.currentText())

        if qtLib != 'default':
            extra.append(qtLib.lower())
        elif gfxSys != 'default':
            extra.append(gfxSys)

        if edited:
            path = os.path.abspath(os.path.dirname(__file__))
            proc = subprocess.Popen([sys.executable, '-'] + extra, stdin=subprocess.PIPE, cwd=path)
            code = str(self.ui.codeView.toPlainText()).encode('UTF-8')
            proc.stdin.write(code)
            proc.stdin.close()
        else:
            fn = self.currentFile()
            if fn is None:
                return
            if sys.platform.startswith('win'):
                os.spawnl(os.P_NOWAIT, sys.executable, '"'+sys.executable+'"', '"' + fn + '"', *extra)
            else:
                os.spawnl(os.P_NOWAIT, sys.executable, sys.executable, fn, *extra)
示例#2
0
	def sendAlert(self, filename411):
		"""Send an RPC Broadcast packet alerting clients to an updated
		411 file. Message was in Ganglia 2.5.x format but now uses RPC.
		Cryptographic signature covers message in format: "filename seqnum".
		"""

		urldir = self.urldir
		if self.group:
			urldir = quote("%s/%s" % (self.urldir, self.group))

		if self.port411 is None:
			alert = "http://%s/%s/%s" % (self.ip, urldir, filename411)
		else:
			alert = "http://%s:%d/%s/%s" % (self.ip, self.port411,
				urldir, filename411)
		sig   = self.sign(alert)

		# use serf, if available, otherwise rocks rpc channel

		if os.path.exists("/opt/rocks/bin/serf"):
			authf = open("/etc/serf/rpcauth","r")
			key = authf.readlines()[0].strip()
			authf.close()
			subprocess.call(["/opt/rocks/bin/serf", "event",
				"--rpc-auth=%s" % key, "--coalesce=false",
				"411Alert",alert]) 
		else:
			os.spawnl(os.P_NOWAIT, '/opt/rocks/sbin/411-alert',
			 	'411-alert', alert, sig)
示例#3
0
文件: tvf.py 项目: neilmayhew/pathway
 def OnCompareButton(self, event):
     sel = self.listBox1.GetSelection()
     base = splitext(basename(self.inp[sel]))[0]
     src = 'Output/%s.xml' % base
     dst = 'Expected/%s.xml' % base
     progParts = os.path.split(winMerge)
     os.spawnl(os.P_WAIT, winMerge, progParts[1], self._Q(src), self._Q(dst))
示例#4
0
文件: spe_winpdb.py 项目: nyimbi/SPE
 def _debug_childActive(self):
     child = self.app.childActive
     if child.confirmSave() and not child.isNew():
         name = child.fileName
         debugDialog = winpdbDialog.dialog(self.app.parentFrame, name)
         answer = debugDialog.ShowModal()
         debugDialog.Destroy()
         if answer != wx.ID_CANCEL:
             _info = self.app.debugInfo
             args = [os.P_NOWAIT, info.PYTHON_EXEC, info.PYTHON_EXEC]
             args.extend(_info["parameters"])
             if os.path.exists(name):
                 if info.WIN and " " in name:
                     name = '"%s"' % name
                 args.append(name)
                 script_args = _info["arguments"]
                 if script_args:
                     args.append(script_args)
             os.spawnl(*args)
             child.setStatus("WinPdb Debugger is succesfully started.", 1)
         else:
             self._check_run(False)
             child.setStatus("WinPdb Debugger was cancelled.", 1)
     else:
         self._check_run(False)
         child.setStatus("File must be saved before WinPdb Debugger is launched.", 1)
def test_scanner(path):
    print('running: %s' % path)
    with tempfile.NamedTemporaryFile('rb') as imports_file:
        with tempfile.NamedTemporaryFile('rb') as usage_file:
            os.spawnl(os.P_WAIT, sys.executable, sys.executable, PROGRAM_PATH,
                      '-t', path, imports_file.name, usage_file.name)
            actual_imports = pickle.load(imports_file)
            actual_usage = pickle.load(usage_file)

    with open(os.path.join(path, 'expected_imports')) as imports_file:
        expected_imports = json.load(imports_file)
    with open(os.path.join(path, 'expected_usage')) as usage_file:
        expected_usage = json.load(usage_file)

    for modpath in expected_imports:
        module_imports = actual_imports.setdefault(modpath, {})
        for name, value in module_imports.items():
            module_imports[name] = sorted(value)
    for modpath in expected_usage:
        actual_usage[modpath] = sorted(actual_usage.get(modpath, []))

    print('expected imports: %s' % json.dumps(expected_imports, sort_keys=1))
    print('  actual imports: %s' % json.dumps(actual_imports, sort_keys=1))

    print('expected usage: %s' % json.dumps(expected_usage, sort_keys=1))
    print('  actual usage: %s' % json.dumps(actual_usage, sort_keys=1))

    assert expected_imports == actual_imports
    assert expected_usage == actual_usage
    print('passed: %s' % path)
示例#6
0
def OpenPDFDocIndex(index, cwd):
    if not os.path.isfile(os.path.join(cwd, "doc","301_v04000201.pdf")):
        return _("""No documentation file available.
Please read can festival documentation to know how to obtain one.""")
    try:
        if index in DS301_PDF_INDEX:
            if wx.Platform == '__WXMSW__':
                readerpath = get_acroversion()
                readerexepath = os.path.join(readerpath,"AcroRd32.exe")
                if(os.path.isfile(readerexepath)):
                    os.spawnl(os.P_DETACH, readerexepath, "AcroRd32.exe", "/A", "page=%d=OpenActions" % DS301_PDF_INDEX[index], '"%s"'%os.path.join(cwd, "doc","301_v04000201.pdf"))
            else:
                os.system("xpdf -remote DS301 %s %d &"%(os.path.join(cwd, "doc","301_v04000201.pdf"), DS301_PDF_INDEX[index]))
        else:
            if wx.Platform == '__WXMSW__':
                readerpath = get_acroversion()
                readerexepath = os.path.join(readerpath,"AcroRd32.exe")
                if(os.path.isfile(readerexepath)):
                    os.spawnl(os.P_DETACH, readerexepath, "AcroRd32.exe", '"%s"'%os.path.join(cwd, "doc","301_v04000201.pdf"))
            else:
                os.system("xpdf -remote DS301 %s &"%os.path.join(cwd, "doc","301_v04000201.pdf"))
        return True
    except:
        if wx.Platform == '__WXMSW__':
            return _("Check if Acrobat Reader is correctly installed on your computer")
        else:
            return _("Check if xpdf is correctly installed on your computer")
示例#7
0
	def write_chm(self, book, path):
		if not sys.platform.startswith('win'):
			raise NotImplementedError, 'Only supported on Windows platform'
		
		dir_ = tempfile.mkdtemp()
		
		name = book.name
			
		formatter = Formatter(book, name)
		
		hhp_name = os.path.join(dir_, name + '.hhp')
		fp = file(hhp_name, 'wt')
		formatter.write_hhp(fp)
		fp.close()
		
		fp = file(os.path.join(dir_, name + '.hhc'), 'wt')
		formatter.write_hhc(fp)
		fp.close()
		
		fp = file(os.path.join(dir_, name + '.hhk'), 'wt')
		formatter.write_hhk(fp)
		fp.close()
		
		for pname in book.archive:
			# FIXME: make parent dirs
			fp = file(os.path.join(dir_, pname), 'wb')
			fp.write(book.archive[pname].read())
			fp.close()

		os.spawnl(os.P_WAIT, 'C:\\Program Files\\HTML Help Workshop\\hhc.exe', 'hhc.exe', hhp_name)

		shutil.move(os.path.join(dir_, name + '.chm'), path)
		
		shutil.rmtree(dir_)
示例#8
0
def SyncAndSleep():
  """Runs sync and sleeps for a few seconds between Firefox runs.
     Otherwise "Firefox is already running.." errors occur
  """

  os.spawnl(os.P_WAIT, paths.SYNC)
  time.sleep(3)
示例#9
0
    def launchCmd(self,event=None):

        global pathToCmd

        d = self._getCurrentNodePath()
        myCmd = 'cd ' + d
        os.spawnl(os.P_NOWAIT, pathToCmd, '/k ', myCmd)
示例#10
0
def build_it_all(version):
  "Now build the thing."
  autogen_prefix= '/prefix' # FIXME: this is specific to tthurman's laptop!

  # FIXME: These should use os.system

  if os.spawnl(os.P_WAIT, './autogen.sh', './autogen.sh', '--prefix', autogen_prefix) != 0:
    print 'autogen failed'
    sys.exit(255)
    
  if os.spawnl(os.P_WAIT, '/usr/bin/make', '/usr/bin/make') != 0:
    print 'make failed'
    sys.exit(255)

  if os.spawnl(os.P_WAIT, '/usr/bin/make', '/usr/bin/make', 'install') != 0:
    print 'install failed'
    sys.exit(255)

  if os.spawnl(os.P_WAIT, '/usr/bin/make', '/usr/bin/make', 'distcheck') != 0:
    print 'distcheck failed'
    sys.exit(255)

  if not os.access(version['filename'], os.F_OK):
    print "Sorry, we don't appear to have a file called %s!" % (archive_filename)
    sys.exit(255)
示例#11
0
 def start_browser(self, config, url, options):
     """Start browser and load website."""
     command = config['command']
     print 'running', command
     os.spawnl(os.P_DETACH, command, os.path.basename(command), url)
     print "Sleeping %d seconds while page is loading." % options.wait
     time.sleep(options.wait)
示例#12
0
def callGmetric(spoof, group, name, value, type, unit, stat_timeout, dryrun):
    logger = logging.getLogger()
    logger.info(
        "%s --group=%s --spoof=%s --name=%s --value=%s --type=%s --units='%s' "
        "--dmax=%i" % (GMETRIC, group, spoof, name, value, type, unit, stat_timeout)
    )

    if dryrun:
        print (
            "%s --group=%s --spoof=%s --name=%s --value=%s --type=%s --units='%s' "
            "--dmax=%i" % (GMETRIC, group, spoof, name, value, type, unit, stat_timeout)
        )

    os.spawnl(
        os.P_WAIT,
        GMETRIC,
        "gmetric",
        "--group=%s" % group,
        "--spoof=%s" % spoof,
        "--name=%s" % name,
        "--value=%s" % value,
        "--type=%s" % type,
        "--units='%s'" % unit,
        "--dmax=%i" % stat_timeout,
    )
示例#13
0
	def make_thumbnails(self):
		"this fuctions calls convert to build the thumbnails from png"
		for f in self.filenames:
			size =  "%dx%d!" % self.size
			cmd = "convert -resize %s %s %s" % (size, f, f + self.suffix)
			os.spawnl(os.P_WAIT, "/usr/bin/convert", 
				*cmd.split())
示例#14
0
def init():
    global screen_width, screen_height
    config = parser.load(game_config)
    # Turn engine.cfg definitions into global variables.
    globals().update(config.todict())
    screen_width = int(screen_width)
    screen_height = int(screen_height)
    try:
        f = open(ika_config)
    except IOError:
        pass
    else:
        # Turn user.cfg definitions into global variables.
        lines = f.readlines()
        for line in lines:
            line = line.split()
            globals()[line[0]] = int(line[1])
        f.close()
    if 'xres' not in globals() or 'yres' not in globals():
        try:
            last_character = open(ika_config, 'rt').read()[-1]
        except IOError:
            last_character = '\n'
        f = open(ika_config, 'aU')
        if last_character != '\n':
            print >> f, '\n',
        if 'xres' not in globals():
            print >> f, 'xres', screen_width
        if 'yres' not in globals():
            print >> f, 'yres', screen_height
        f.close()
        import os
        os.spawnl(os.P_NOWAIT, 'ika.exe')
        ika.Exit()
示例#15
0
    def setup(self, args):
        setup = args.pop(0)
        if os.path.isdir(setup):
            setup = os.path.join(setup, "setup.py")

        # self._logger.info("Running setup script %r.", setup)
        setup = os.path.abspath(setup)

        fd, tsetup = tempfile.mkstemp()
        try:
            os.write(
                fd,
                zc.buildout.easy_install.runsetup_template
                % dict(setuptools=pkg_resources_loc, setupdir=os.path.dirname(setup), setup=setup, __file__=setup),
            )
            os.spawnl(
                os.P_WAIT,
                sys.executable,
                zc.buildout.easy_install._safe_arg(sys.executable),
                tsetup,
                *[zc.buildout.easy_install._safe_arg(a) for a in args]
            )
        finally:
            os.close(fd)
            os.remove(tsetup)
示例#16
0
 def start(self, imports=None):
     """Start cherryd in a subprocess."""
     cherrypy._cpserver.wait_for_free_port(self.host, self.port)
     
     args = [sys.executable, os.path.join(thisdir, '..', 'cherryd'),
             '-c', self.config_file, '-p', self.pid_file]
     
     if not isinstance(imports, (list, tuple)):
         imports = [imports]
     for i in imports:
         if i:
             args.append('-i')
             args.append(i)
     
     if self.daemonize:
         args.append('-d')
     
     if self.wait:
         self.exit_code = os.spawnl(os.P_WAIT, sys.executable, *args)
     else:
         os.spawnl(os.P_NOWAIT, sys.executable, *args)
         cherrypy._cpserver.wait_for_occupied_port(self.host, self.port)
     
     # Give the engine a wee bit more time to finish STARTING
     if self.daemonize:
         time.sleep(2)
     else:
         time.sleep(1)
示例#17
0
def run_setup(command):
    """ run the setup.py with a particular command """
    oldDir = os.getcwd()
    os.chdir("fakepackage")
    py = sys.executable
    os.spawnl(os.P_WAIT, py, py, "setup.py", command)
    os.chdir(oldDir)
示例#18
0
 def write(self):
     """Finish writing out the deployement archive"""
     topfiles = self.topfiles.keys()
     topfiles.sort()
     filestr = " ".join(topfiles)
     os.spawnl(os.P_WAIT, "/bin/sh", "sh", "-c", "(cd %s && tar cf - %s) | gzip -c --rsyncable > %s" % (self.outdir, filestr, self.darfile))
     os.spawnl(os.P_WAIT, "/bin/rm", "rm", "-rf", self.outdir)
示例#19
0
文件: setup.py 项目: sippy/vapp
 def run(self):
     print "compiling gettext files"
     os.chdir("po")
     for fname in glob.glob("*.po"):
         os.spawnl(os.P_WAIT, "./compilepo.sh", "./compilepo.sh", fname[:-3], self.root, self.prefix)
     os.chdir(os.pardir)
     _install.run(self)
示例#20
0
def packageWindows(opts):
    outdir = getOutdir(opts)
    vc8Path = join(outdir, 'dom-vc8')
    vc9Path = join(outdir, 'dom-vc9')

    if getCompiler(opts) in ['vc8', 'all']:
        print 'Doing VC8 build'
        os.spawnl(os.P_WAIT, join(vc8Path, 'dom', 'projects', 'vc8', 'build.bat'))
        zip = createArchive(join(outdir, 'colladadom-vc8'), getArchive(opts))
        packageDomFilesVC(zip, vc8Path)

        # Build RT and add it to the VC8 zip file
        print 'Building RT'
        os.spawnl(os.P_WAIT, join(vc8Path, 'rt', 'projects', 'VC++8', 'build.bat'))
        packageRTFilesVC(zip, vc8Path)

    if getCompiler(opts) in ['vc9', 'all']:
        # This could be automated but I don't have a copy of VC9. Argh!
        print '\n\nTime for the VC9 build. Make sure the project files in the VC9 path are converted,\n' \
            + 'then open the solution and do both a debug and release build. Press enter when\n' \
            + 'the build is finished.'
        raw_input('\nWaiting for user response...')
        print 'ok'

        zip = createArchive(join(outdir, 'colladadom-vc9'), getArchive(opts))
        packageDomFilesVC(zip, vc9Path)
示例#21
0
def process(tasks):
    (source, foo) = os.path.split(tasks[0])
    if(source == ""):
        source = inputFile
    else:
        if finished.count(source) == 0:
            printlock.acquire()
            print "trying to split from", source, "which is not finished yet, re-queuing and sleeping 5 seconds"
            printlock.release()
            q.put(tasks)
            time.sleep(5)
            return

        source = outputDir + "/" + source + dataType

    if not simulate and not os.path.exists(source):
        source = inputFile

    printlock.acquire()
    print "splitting", source, "to", tasks
    printlock.release()

    if(sys.argv.count("--plan") > 0):
        return

    (fp, configfile) = tempfile.mkstemp()
    os.write(fp, "# auto-generated\n")
    for task in tasks:
        dest = os.path.join(outputDir, task + dataType)
        dirname = os.path.dirname(dest)

        if not os.path.exists(dirname):
            printlock.acquire()
            print "Creating", dirname
            os.mkdir(dirname)
            printlock.release()

        os.write(fp, dest)
        os.write(fp, "\t")
        os.write(fp, clipType)
        os.write(fp, "\t")
        os.write(fp, clipDir + "/" + task + clipExtension)
        os.write(fp, "\n")

    os.close(fp)

    start = datetime.now()
    if(simulate):
        time.sleep(random.randint(1, 10))
    else:
        os.spawnl(os.P_WAIT, splitterCommand, splitterCommand, "--hardcut", source, configfile)

    printlock.acquire()
    print "finished splitting to", tasks
    print "runtime:", datetime.now() - start
    printlock.release()
    for task in tasks:
        finished.append(task)

    os.unlink(configfile)
示例#22
0
    def __init__(self, data):
        if (not os.path.exists(data)):
            raise c3errors.FileDoesNotExistException("ClusterDocumentGroup data file does not exist.")
        sort = self.sortPath
        if (not os.path.exists(sort)):
            raise c3errors.FileDoesNotExistException("Sort utility for ClusterDocumentGroup does not exist.")
        
        sorted = data + "_SORT"
        os.spawnl(os.P_WAIT, sort, sort, data, '-o', sorted)

        # Now construct cluster documents.
        doc = ["<cluster>"]
        f = file(sorted)
        l = f.readline()
        # term docid recstore occs (line, posn)*
        currKey = ""
        while(l):
            docdata = {}
            ldata = l.split('\x00')
            key = ldata[0]
            if (not key):
                # Data from records with no key
                l = f.readline()
                l = l[:-1]
                continue

            doc.append("<key>%s</key>\n" % (key))
            ldata = ldata[1:-1]
            for bit in range(len(ldata)/2):
                d = docdata.get(ldata[bit*2], [])                
                d.append(ldata[bit*2+1])
                docdata[ldata[bit*2]] = d

                
            l = f.readline()
            l = l[:-1]
            ldata2 = l.split('\x00')
            key2 = ldata2[0]
            while key == key2:   
                ldata2 = ldata2[1:-1]
                for bit in range(len(ldata2)/2):
                    d = docdata.get(ldata2[bit*2], [])
                    d.append(ldata2[bit*2+1])
                    docdata[ldata2[bit*2]] = d
                l = f.readline()
                l = l[:-1]
                ldata2 = l.split('\x00')
                key2 = ldata2[0]
               

            for k in docdata.keys():
                doc.append("<%s>" % (k))
                for i in docdata[k]:                    
                    doc.append("%s" % i)
                doc.append("</%s>" % (k))
            doc.append("</cluster>")
            self.doctexts.append(" ".join(doc))
            doc = ["<cluster>"]
            l = f.readline()
            l = l[:-1]
示例#23
0
def establishInternetConnection():
    # establish connection
    timeout = time.time()+15 # 15 seconds timeout
    os.spawnl(os.P_NOWAIT, "ping", "ping", "-w", "1", "www.hillier.de")
    c_status = ""
    # wait 30 secs for connect
    while c_status != "CONNECTED" and time.time() < timeout:
        lines = commands.getoutput("/usr/sbin/cinternet --status")
        for l in lines.splitlines():
            if l.startswith("status"):
                c_status = l[9:].strip()
        print 'status:', c_status
        time.sleep(1)
    # get ip address
    save_lang = os.environ["LANG"]
    os.environ["LANG"] = ""
    lines = commands.getoutput("/sbin/ifconfig ppp0")
    os.environ["LANG"] = save_lang
    for l in lines: # no need to split into lines
        index = l.find("inet addr:")
        if index >= 0:
            index += 10
            rindex = l.find(" ", index)
            ip_address = l[index:rindex]
    # play ip address
    for i in ip_address:
        cc.audio_send(i+".la")
示例#24
0
文件: transitions.py 项目: abhi11/dak
def write_transitions_from_file(from_file):
    """
    We have a file we think is valid; if we're using sudo, we invoke it
    here, otherwise we just parse the file and call write_transitions

    @attention: This function usually runs B{within sudo}

    @type from_file: filename
    @param from_file: filename of a transitions file

    """

    # Lets check if from_file is in the directory we expect it to be in
    if not os.path.abspath(from_file).startswith(Cnf["Dir::TempPath"]):
        print "Will not accept transitions file outside of %s" % (Cnf["Dir::TempPath"])
        sys.exit(3)

    if Options["sudo"]:
        os.spawnl(os.P_WAIT, "/usr/bin/sudo", "/usr/bin/sudo", "-u", "dak", "-H",
              "/usr/local/bin/dak", "transitions", "--import", from_file)
    else:
        trans = load_transitions(from_file)
        if trans is None:
            raise TransitionsError("Unparsable transitions file %s" % (file))
        write_transitions(trans)
示例#25
0
def executeRuns(paramList, paramFilePath, outputFilePath):
    # is paramList ok to use?
    if not validateParams(paramList):
        raise ValueError("paramList failed validation")
    # write data for fortran program
    numRuns = len(paramList)
    paramFile = open(paramFilePath, "w")
    paramFile.write(str(numRuns) + "\n")
    for params in paramList:
        for key in paramOrder():
            paramFile.write(str(params[key]) + " ")
        paramFile.write("\n")
    paramFile.close()
    # run fortran program and wait for it to finish
    os.spawnl(os.P_WAIT, "main.out", "main.out", paramFilePath, outputFilePath)
    # read output
    outputList = []
    outputFile = open(outputFilePath, "r")
    outputFile.readline()  # skip first line
    for line in outputFile.readlines():
        if line[0] == "!":
            outputList.append({})
            continue
        values = line.split()
        lineDict = {}
        for i, key in enumerate(outOrder()):
            lineDict[key] = values[i]
        outputList.append(lineDict)
    return outputList
示例#26
0
def installSSH():
    pdebug("Installing SSH...")
    # Run this in the background since it leaves an annoying popup.
    os.spawnl(os.P_NOWAIT, "%s\\install\\ssh\\setupssh.exe" % 
             (os.getenv("SystemDrive")), "setupsssh.exe", "/S")
    os.system("NETSH FIREWALL SET PORTOPENING TCP 22 \"SSH\" ENABLE")
   
    # Install location depends on architecture.
    while True:
        if os.path.exists("%s\\OpenSSH" % ("C:\\PROGRA~2")):
            sshpath = "%s\\OpenSSH" % ("C:\\PROGRA~2")
            break
        elif os.path.exists("%s\\OpenSSH" % ("C:\PROGRA~1")):
            sshpath = "%s\\OpenSSH" % ("C:\\PROGRA~1")
            break
        else:
            time.sleep(5)
    pdebug("OpenSSH is installed in %s." % (sshpath))

    time.sleep(30)

    # Perform post-install actions.
    os.unlink("%s\\etc\\banner.txt" % (sshpath))
    os.system("%s\\bin\\mkgroup -l >> %s\\etc\\group" % (sshpath, sshpath))
    os.system("%s\\bin\\mkpasswd -l >> %s\\etc\\passwd" % (sshpath, sshpath))

    f = file("%s\\ssh.cmd" % (os.getenv("SystemDrive")), "w")
    f.write("net start opensshd\n")
    f.close()
    addRun("%s\ssh.cmd" % (os.getenv("SystemDrive")))
示例#27
0
def StartAcrobatReader(filename):
    global dde_server
    import win32api
    import win32ui
    import dde
    
    filename = unicode(os.path.abspath(filename))
    path, name = os.path.split(filename)
    reader = win32api.FindExecutable(name, path)
    os.spawnl(os.P_NOWAIT, reader[1], " ")
    
    for t in range(10):
        time.sleep(1)
        for acrobat in DDE_ACROBAT_STRINGS:
            try:
                if not dde_server:
                    dde_server = dde.CreateServer()
                    dde_server.Create('Gertrude')
                c = dde.CreateConversation(dde_server)
                c.ConnectTo(acrobat, 'control')
                c.Exec('[DocOpen("%s")]' % (filename,))
                return
            except Exception, e:
                pass
        print "Impossible de lancer acrobat reader ; prochain essai dans 1s ...", e
示例#28
0
 def OnHelpCANFestivalMenu(self, event):
     # self.OpenHtmlFrame("CAN Festival Reference", os.path.join(ScriptDirectory, "doc/canfestival.html"), wx.Size(1000, 600))
     if wx.Platform == "__WXMSW__":
         readerpath = get_acroversion()
         readerexepath = os.path.join(readerpath, "AcroRd32.exe")
         if os.path.isfile(readerexepath):
             os.spawnl(
                 os.P_DETACH,
                 readerexepath,
                 "AcroRd32.exe",
                 '"%s"' % os.path.join(ScriptDirectory, "doc", "manual_en.pdf"),
             )
         else:
             message = wx.MessageDialog(
                 self,
                 _("Check if Acrobat Reader is correctly installed on your computer"),
                 _("ERROR"),
                 wx.OK | wx.ICON_ERROR,
             )
             message.ShowModal()
             message.Destroy()
     else:
         try:
             os.system("xpdf -remote CANFESTIVAL %s %d &" % (os.path.join(ScriptDirectory, "doc/manual_en.pdf"), 16))
         except:
             message = wx.MessageDialog(
                 self, _("Check if xpdf is correctly installed on your computer"), _("ERROR"), wx.OK | wx.ICON_ERROR
             )
             message.ShowModal()
             message.Destroy()
示例#29
0
    def loadFile(self, edited=False):
        
        extra = []
        if self.ui.pyqtCheck.isChecked():
            extra.append('pyqt')
        elif self.ui.pysideCheck.isChecked():
            extra.append('pyside')
        
        if self.ui.forceGraphicsCheck.isChecked():
            extra.append(str(self.ui.forceGraphicsCombo.currentText()))

        
        #if sys.platform.startswith('win'):
            #os.spawnl(os.P_NOWAIT, sys.executable, '"'+sys.executable+'"', '"' + fn + '"', *extra)
        #else:
            #os.spawnl(os.P_NOWAIT, sys.executable, sys.executable, fn, *extra)
        
        if edited:
            path = os.path.abspath(os.path.dirname(__file__))
            proc = subprocess.Popen([sys.executable, '-'] + extra, stdin=subprocess.PIPE, cwd=path)
            code = str(self.ui.codeView.toPlainText()).encode('UTF-8')
            proc.stdin.write(code)
            proc.stdin.close()
        else:
            fn = self.currentFile()
            if fn is None:
                return
            if sys.platform.startswith('win'):
                os.spawnl(os.P_NOWAIT, sys.executable, '"'+sys.executable+'"', '"' + fn + '"', *extra)
            else:
                os.spawnl(os.P_NOWAIT, sys.executable, sys.executable, fn, *extra)
示例#30
0
    def new_spawnl(mode, path, *args):
        '''
os.spawnl(mode, path, arg0, arg1, ...)
os.spawnlp(mode, file, arg0, arg1, ...)
        '''
        import os
        args = patch_args(args)
        return getattr(os, original_name)(mode, path, *args)
示例#31
0
 def start_job(self, pload):
     # spawn a delta rebuild job
     spawn_args = [APPLYDELTA, APPLYDELTA,
                   '-a', pload.pkg.arch,
                   pload.localPkg(), pload.pkg.localPkg()]
     pid = os.spawnl(os.P_NOWAIT, *spawn_args)
     logger.log(dnf.logging.SUBDEBUG, 'drpm: spawned %d: %s', pid,
                ' '.join(spawn_args[1:]))
     self.jobs[pid] = pload
def bash(command, mode='o'):
    """Execute a bash command. Return the output, the return value, or both.

	mode may be o (output), v (return value), or ov (tuple (output, value).
	"""
    if 'v' == mode:
        return os.spawnl(os.P_WAIT, '/bin/bash', 'bash', '-c', command)
    else:
        return _bash2(command, mode)
示例#33
0
 def start_browser(self, config, url, options):
     """
     Start browser and load website.
     """
     if config['major'] == 2:
         defcmd = r'c:\progra~1\flock\flock.exe'
     else:
         defcmd = r'c:\progra~1\flock\flock\flock.exe'
     command = config['command'] or defcmd
     print 'running', command
     try:
         import subprocess
     except ImportError:
         os.spawnl(os.P_DETACH, command, os.path.basename(command), url)
     else:
         subprocess.Popen([command, url])
     print "Sleeping %d seconds while page is loading." % options.wait
     time.sleep(options.wait)
示例#34
0
 def OnHelpCANFestivalMenu(self, event):
     #self.OpenHtmlFrame("CAN Festival Reference", os.path.join(ScriptDirectory, "doc/canfestival.html"), wx.Size(1000, 600))
     if wx.Platform == '__WXMSW__':
         readerpath = get_acroversion()
         readerexepath = os.path.join(readerpath,"AcroRd32.exe")
         if(os.path.isfile(readerexepath)):
             os.spawnl(os.P_DETACH, readerexepath, "AcroRd32.exe", '"%s"'%os.path.join(ScriptDirectory, "doc","manual_en.pdf"))
         else:
             message = wx.MessageDialog(self, _("Check if Acrobat Reader is correctly installed on your computer"), _("ERROR"), wx.OK|wx.ICON_ERROR)
             message.ShowModal()
             message.Destroy()
     else:
         try:
             os.system("xpdf -remote CANFESTIVAL %s %d &"%(os.path.join(ScriptDirectory, "doc/manual_en.pdf"),16))
         except:
             message = wx.MessageDialog(self, _("Check if xpdf is correctly installed on your computer"), _("ERROR"), wx.OK|wx.ICON_ERROR)
             message.ShowModal()
             message.Destroy()
示例#35
0
def makeDisk():
    if (os.path.exists("testdisk.raw")):
        os.remove("testdisk.raw")
    fd = os.open("testdisk.raw", os.O_RDWR|os.O_CREAT )
    os.ftruncate(fd, 4194304)
    os.close(fd)
    os.spawnl(os.P_WAIT, "/sbin/sgdisk", "sgdisk", "-U",
          "375a56f7-d6c9-4e81-b5f0-09d41ca89efe", "testdisk.raw")
    os.spawnl(os.P_WAIT, "/sbin/sgdisk", "sgdisk", "--new=1:2048:2560", "testdisk.raw")
    os.spawnl(os.P_WAIT, "/sbin/sgdisk", "sgdisk", "--new=2:4096:4608", "testdisk.raw")
    os.spawnl(os.P_WAIT, "/sbin/gdisk", "sgdisk", "-l", "testdisk.raw")
示例#36
0
    def SpawnCommand(self, cmd):

        # Use P_WAIT because process_message will require database
        # locks so there is no sense in parallizing it.

        if (not os.path.exists(dibs_options.lockfile)):
            dibs_logger.Logger.PrintAndLog('Spawning ' + ` cmd ` + '.\n',
                                           dibs_logger.LOG_INFO)
            os.spawnl(os.P_WAIT, dibs_options.pythonExe,
                      dibs_options.pythonExe, dibs_options.dibsExe, cmd)
            return 1
        else:
            print('[' + ` time.asctime(time.localtime(time.time())) ` +
                  ']: Not spawning ' + ` cmd ` +
                  ' since database locked, try again later.\n')
            MailUserIfLockfileTooOld(dibs_options.lockfile,
                                     dibs_options.dibsAdmin,
                                     dibs_options.smtpServer)
            return 0
示例#37
0
def convert_to_png(dataset, outfile):
    """
	Converts the given dataset to a PNG raster image through a GIF
	intermediate with ImageMagick.
	The PNG output direct form GDAL *cannot* be read using Google Earth, so
	we add indirection through GIF.
	"""

    # tmpnam is supposedly a sec hazard, but the GDAL library wants a real filename...
    warnings.filterwarnings("ignore", "tmpnam is a potential security risk")
    outname = os.tmpnam()
    warnings.resetwarnings()

    gdal.GetDriverByName("GIF").CreateCopy(outname, dataset, 0)

    os.spawnl(os.P_WAIT, convert_path, convert_path, outname,
              'png:%s' % outfile)
    os.unlink(outname)
    return
示例#38
0
 def _start_setup(self):
     if self._setup_pid != 0:
         pid, status = os.waitpid(self._setup_pid, os.WNOHANG)
         if pid != self._setup_pid:
             return
         self._setup_pid = 0
     filename = os.path.join(package.get_libexecdir(),
                             'ibus-setup-hiragana')
     self._setup_pid = os.spawnl(os.P_NOWAIT, filename,
                                 'ibus-setup-hiragana')
示例#39
0
def spawn(executable, *args, **kwargs):
    cwd = kwargs.get('cwd')
    oldCwd = os.getcwd()
    if cwd:
        os.chdir(cwd)
    try:
        result = os.spawnl(os.P_WAIT, executable, executable, *args)
    finally:
        os.chdir(oldCwd)
    return result
示例#40
0
def openurl(filename, numOfLine):
    f = open(filename, "r+")
    lines = f.readlines()
    f.close()

    f = open(filename, "r+")
    try:
        line = lines[numOfLine - 1].strip()
        urltxt = re.search(r"(http|https|ftp|ftps):\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?", line)
        if urltxt is not None:
            url = urltxt.group(0)
            # os.startfile(url)
            os.spawnl(os.P_NOWAIT, r'C:\Program Files\Mozilla Firefox\Firefox.exe', r'FireFox', '-new-tab', url)
        else:
            print("no URL in task")
    except:
        print(str(numOfLine) + " task is not exists")
    finally:
        f.close()
示例#41
0
 def _python_cmd(*args):
     args = (sys.executable,) + args
     # quoting arguments if windows
     if sys.platform == 'win32':
         def quote(arg):
             if ' ' in arg:
                 return '"%s"' % arg
             return arg
         args = [quote(arg) for arg in args]
     return os.spawnl(os.P_WAIT, sys.executable, *args) == 0
示例#42
0
    def Cut(self, matfile, r1, r2):
        tempdir = "/home/braun/Diplom/temp"
        fname = "%032X.asc" % random.randint(0, 2**128)

        tvcmds = "cut activate 0; "
        tvcmds += "cut attach matrix 1; "
        tvcmds += "cut attach dir 2; "

        tvcmds += "cut dir open 2 %s; " % tempdir
        tvcmds += "cut matrix open 1 %s; " % matfile

        # Sub-channel resolution is really useless here,
        # because TV cuts only with channel resolution anyway

        tvcmds += "cut marker cut enter %.1f; " % r1
        tvcmds += "cut marker cut enter %.1f; " % r2

        for bg in self.fBgRegions:
            tvcmds += "cut marker bg-gate enter %.1f;" % bg

        tvcmds += "cut create cut; "

        tvcmds += "spec write %s'txt active; " % (tempdir + "/" + fname)

        tvcmds += "exit; "

        os.spawnl(
            os.P_WAIT,
            "/usr/bin/xvfb-run",
            "/usr/bin/xvfb-run",
            "-w",
            "0",
            "/ikp/bin/tv",
            "-src",
            "-rc",
            "-e",
            tvcmds,
        )

        time.sleep(0.5)

        return tempdir + "/" + fname
示例#43
0
def startrender(term, ttype, tcmd):
    global ranges
    global sframes
    global eframes

    outpath = getrenderoutputpath()
    if outpath == None:
        return

    pc(len(ranges), "Start render ranges")

    if term:

        for n in range(0, len(ranges)):
            shstr = ""
            if ttype == "GN":
                shstr = "gnome-terminal --title=Rendering_Section_" + ranges[
                    n] + " --command=\"bash -c './" + ranges[n] + ".sh;'\""
            if ttype == "XF":
                shstr = "xfce4-terminal --title=Rendering_Section_" + ranges[
                    n] + " --command=\"bash -c './" + ranges[n] + ".sh;'\""
            if ttype == "KN":
                shstr = "konsole --title=Rendering_Section_" + ranges[
                    n] + " --command=\"bash -c './" + ranges[n] + ".sh;'\""
            if ttype == "EM":
                shstr = "x-terminal-emulator --title=Rendering_Section_" + ranges[
                    n] + " --command=\"bash -c './" + ranges[n] + ".sh;'\""
            if ttype == "SB":
                shstr = tcmd.replace("$scriptname", ranges[n] + ".sh")
                pc(shstr)
                #shstr = gnome-terminal --command="bash -c './$scriptname;'" # This works for example

            print(os.getcwd())
            os.chdir(outpath)
            print(os.getcwd())
            os.system(shstr)
    else:
        for n in range(0, len(ranges)):
            cmd = outpath + ranges[n] + ".sh"
            os.spawnl(os.P_NOWAIT, cmd, cmd)
            #pc(n + 1, cmd)
            pc(n + 1, "Launching part")
示例#44
0
def runKeosd(flag):
    # TODO rewrite function
    if flag:
        try:
            out = os.spawnl(os.P_NOWAIT, 'keosd', '--wallet-dir',
                            '~/eosio-wallet')
        except Exception as e:
            print('Could not run keosd by default path: ' + str(e))
            out = "Could not run keosd by default path: " + str(e)
        finally:
            app.outputPanel.logger(str(out))
    else:
        try:
            out = os.spawnl(os.P_NOWAIT, 'keosd', '--wallet-dir',
                            app.tabPanel.walletDir.get())
        except Exception as e:
            print('Could not run keosd ' + str(e))
            out = "Could not run keosd " + str(e)
        finally:
            return str(out)
示例#45
0
    async def restartbot(self):
        """
        Restarts the bot. Owner only.
        :return:
        """
        msg = await self.bot.say("Restarting...")
        print('Restarting...')
        await self.bot.change_presence(status=Status.dnd, game=None)

        # calls the command to start the bot, and passes the message's id, so the bot can edit it when it starts.
        if os.name == 'nt':
            os.spawnl(
                os.P_NOWAIT, executable,
                *([executable] + [argv[0], argv[1]] +
                  [msg.id, msg.channel.id]))
        else:
            os.execl(
                executable,
                *([executable] + [argv[0], argv[1]] +
                  [msg.id, msg.channel.id]))
示例#46
0
 def test_4_Autoreload(self):
     if not self.server_class:
         print "skipped (no server) ",
         return
     
     # Start the demo script in a new process
     demoscript = os.path.join(os.getcwd(), os.path.dirname(__file__),
                               "test_states_demo.py")
     host = cherrypy.server.socket_host
     port = cherrypy.server.socket_port
     cherrypy._cpserver.wait_for_free_port(host, port)
     
     args = [sys.executable, demoscript, host, str(port)]
     if self.scheme == "https":
         args.append('-ssl')
     pid = os.spawnl(os.P_NOWAIT, sys.executable, *args)
     pid = str(pid)
     cherrypy._cpserver.wait_for_occupied_port(host, port)
     
     try:
         self.getPage("/pid")
         assert self.body.isdigit(), self.body
         pid = self.body
         
         # Give the autoreloader time to cache the file time.
         time.sleep(2)
         
         # Touch the file
         f = open(demoscript, 'ab')
         f.write(" ")
         f.close()
         
         # Give the autoreloader time to re-exec the process
         time.sleep(2)
         cherrypy._cpserver.wait_for_occupied_port(host, port)
         
         self.getPage("/pid")
         assert self.body.isdigit(), self.body
         self.assertNotEqual(self.body, pid)
         pid = self.body
     finally:
         # Shut down the spawned process
         self.getPage("/stop")
     
     try:
         try:
             # Mac, UNIX
             print os.wait()
         except AttributeError:
             # Windows
             print os.waitpid(int(pid), 0)
     except OSError, x:
         if x.args != (10, 'No child processes'):
             raise
示例#47
0
 def start_browser(self, config, url, options):
     """
     Start browser and load website.
     """
     command = config['command']
     if not command:
         appdata = shell.SHGetFolderPath(0, shellcon.CSIDL_LOCAL_APPDATA, 0,
                                         0)
         command = appdata + '\Google\Chrome\Application\chrome.exe'
     print 'running', command
     try:
         import subprocess
     except ImportError:
         os.spawnl(os.P_DETACH, command, os.path.basename(command), url)
     else:
         subprocess.Popen([command, url])
     print "Sleeping %d seconds while page is loading." % options.wait
     time.sleep(options.wait - 10)
     self.maximize()
     time.sleep(10)
示例#48
0
def setup():
    global server_pid, conn, config
    server_pid = os.spawnl(os.P_NOWAIT,
                           os.path.join(config.BPATH, config.BEANSTALKD),
                           os.path.join(config.BPATH, config.BEANSTALKD), '-l',
                           config.BEANSTALKD_HOST, '-p',
                           config.BEANSTALKD_PORT)
    print "server started at process", server_pid
    time.sleep(0.1)
    conn = serverconn.ServerConn(config.BEANSTALKD_HOST,
                                 int(config.BEANSTALKD_PORT))
示例#49
0
 def _start_setup(self):
     if Engine.__setup_pid != 0:
         pkd, state = os.waitpid(Engine.__setup_pid, os.P_NOWAIT)
         if pid != Engine.__setup_pid:
             return
         Engine.__setup_pid = 0
     if os.getenv('LIBEXECDIR') == None:
         return
     setup_cmd = path.join(os.getenv('LIBEXECDIR'), "ibus-setup-xkbc")
     Engine.__setup_id = os.spawnl(os.P_NOWAIT, setup_cmd,
                                   "ibus-setup-xkbc")
    def create(self):
        syborg_serial.create(self)

        # Find the path of the emulator executable
        path = os.path.dirname(sys.executable)
        executable = os.getenv("SVP_MODEM_EXECUTABLE")
        if None == executable:
            executable = self.modem_executable

        executable_name = executable
        fq_executable = os.path.join(path, executable_name)
        print(fq_executable)

        if not os.path.exists(fq_executable):
            executable_name = executable + ".exe"
            fq_executable = os.path.join(path, executable_name)

            if not os.path.exists(fq_executable):
                sys.exit("Could not locate modem executable '" + executable +
                         "' in '" + path + "'!\n")

        # Attempt to find the correct port from the target spec
        target = self.properties["target"]

        if not (target.startswith("tcp:") or target.startswith("udp:")):
            sys.exit("Modem device is not accessed via an acceptable socket.")

        target = target[4:]
        port_start_idx = target.find(":")
        port_end_idx = target.find(",")
        if -1 == port_start_idx:
            sys.exit("Could not extract port number from modem target spec!")

        port = ""
        if -1 == port_end_idx:
            port = target[port_start_idx + 1:]
        else:
            port = target[port_start_idx + 1:port_end_idx]

        os.spawnl(os.P_NOWAIT, fq_executable, executable_name, "-p", port)
        self.chardev.handle_connect()
示例#51
0
def compileTinyDB(logger):
    os.chdir(os.getenv('TOSROOT') + "/apps/TinyDBApp ")

    exitVal = os.spawnl(os.P_WAIT, '/usr/bin/make', '/usr/bin/make', 'pc')

    if (exitVal != 0):
        logger.warning('TinyDB compilation error')
        print 'TinyDB compilation error'
        sys.exit(2)
    else:
        logger.info('TinyDB compilation successul')
        print 'TinyDB compilation successul'
示例#52
0
文件: ida_plugin.py 项目: doronz88/fa
def open_file(filename):
    """
    Attempt to open the given filename by OS' default editor
    :param filename: filename to open
    :return: None
    """
    if sys.platform == "win32":
        try:
            os.startfile(filename)
        except Exception as error_code:
            if error_code[0] == 1155:
                os.spawnl(os.P_NOWAIT,
                          os.path.join(os.environ['WINDIR'],
                                       'system32', 'Rundll32.exe'),
                          'Rundll32.exe SHELL32.DLL, OpenAs_RunDLL {}'
                          .format(filename))
            else:
                print("other error")
    else:
        opener = "open" if sys.platform == "darwin" else "xdg-open"
        subprocess.call([opener, filename])
示例#53
0
文件: ra.py 项目: renesugar/ra-ra
 def __call__(self, target, source, env):
     print("-> running %s \n___________________" % str(self.args))
     r = os.spawnl(os.P_WAIT, self.args[0], self.args[0],
                   *self.args[1:])
     print("^^^^^^^^^^^^^^^^^^^")
     print('r ', r)
     if not r:
         print("PASSED %s" % str(self.args))
         call(['touch', target[0].abspath])
     else:
         print("FAILED %s" % str(self.args))
     return r
示例#54
0
def legacy_spawn_apis(proc, args):
    """
    Deprecated APIs, but still possible attacks
    """
    os.execl(proc, args)
    os.execl(proc, args)
    os.execle(proc, args)
    os.execlp(proc, args)
    os.execlpe(proc, args)
    os.execv(proc, args)
    os.execve(proc, args)
    os.execvp(proc, args)
    os.execvpe(proc, args)
    os.spawnl(proc, args)
    os.spawnle(proc, args)
    os.spawnlp(proc, args)
    os.spawnlpe(proc, args)
    os.spawnv(proc, args)
    os.spawnve(proc, args)
    os.spawnvp(proc, args)
    os.spawnvpe(proc, args)
示例#55
0
    def run(self):
        write_log("................................")
        write_log(">> mnservice run - pid = {0}".format(self.pid))
        write_log("................................")
        if self.dashd_pid:
            write_log("-> dashd find - pid = {0}".format(self.dashd_pid))
        while True:
            if not is_executed_pid('dashd', self.dashd_pid):
                write_log("** dashd not find - pid = {0}".format(
                    self.dashd_pid))
                pp = self.workpath + '/' + 'dashd'
                try:
                    os.spawnl(os.P_WAIT, pp, '')
                    time.sleep(2)
                    self.dashd_pid = get_dashd_pid()
                    write_log("-> dashd restart - pid = {0}".format(
                        self.dashd_pid))

                except:
                    pass
            time.sleep(10 * 60)
示例#56
0
def egg2bam(file, bam):
    present = os.path.exists(bam)
    if (present): bam = "packpanda-TMP.bam"
    cmd = 'egg2bam -noabs -ps rel -pd . "' + file + '" -o "' + bam + '"'
    print "Executing: " + cmd
    if (sys.platform == "win32"):
        res = os.spawnl(os.P_WAIT, EGG2BAM, cmd)
    else:
        res = os.system(cmd)
    if (res != 0): sys.exit("Problem in egg file: " + file)
    if (present) or (OPTIONS["bam"] == 0):
        os.unlink(bam)
示例#57
0
    def sample_mode(self):
        print("采样模式")
        bat = pjoin(self.config.gnu_radio_path, "run_gr.bat")
        rx_py = pjoin(self.config.gnu_radio_path, "uhd_rx_cfile.py")

        for i in range(self.config.sample_times):
            if self.start_sample:
                self.out_file_name = "{}_fc_{:d}_bw_{:d}_N_{:d}.dat".format(
                    self.get_time(), self.config.fc, self.config.fs,
                    self.config.sample_nums)
                output_path = pjoin(self.config.save_path, self.out_file_name)
                os.spawnl(
                    os.P_WAIT, bat,
                    f"{bat} {rx_py} {output_path} -s -f {self.config.fc} -r {self.config.fs} -N {self.config.sample_nums}"
                )
                self.one_sample_end.emit(i + 1, output_path)
            else:
                break

        if self.start_sample:
            self.all_sample_end.emit()
示例#58
0
    def sendAlert(self, filename411):
        """Send an RPC Broadcast packet alerting clients to an updated
		411 file. Message was in Ganglia 2.5.x format but now uses RPC.
		Cryptographic signature covers message in format: "filename seqnum".
		"""

        urldir = self.urldir
        if self.group:
            urldir = quote("%s/%s" % (self.urldir, self.group))

        if self.port411 is None:
            alert = "http://%s/%s/%s" % (self.ip, urldir, filename411)
        else:
            alert = "http://%s:%d/%s/%s" % (self.ip, self.port411, urldir,
                                            filename411)
        sig = self.sign(alert)

        # replace ganglia channel with the rocks rpc channel

        os.spawnl(os.P_NOWAIT, '/opt/rocks/sbin/411-alert', '411-alert', alert,
                  sig)
示例#59
0
 def app_start_kodi(self):
     """Starte KODI"""
     # laeuft nicht, ich versuch mal zu starten
     for timerVal in range(20):
         self.log.debug("kodi not running yet...Try to start (%d)" % int(timerVal))
         pid_kodi = os.spawnl(os.P_NOWAIT, self.mediaPlayerExec, self.mediaPlayerParam)
         self.log.debug("kodi starting with pid %d" % int(pid_kodi))
         sleep(5)
         if self.is_kodi_running():
             self.log.info("kodi should started...")
             return True
     return False
示例#60
0
def scanForViruses(volumeToScan):
    clear1306()
    printLarge1306(0, 0, 'Scanning')
    printSmall1306(0, 14, volumeToScan.replace('/media/', ''))
    scanOutput = str(clamavDaemon.contscan_file(str(volumeToScan)))
    foundcounter = 0
    last_found = -1  # Begin at -1 so the next position to search from is 0
    while True:
        last_found = scanOutput.find(virusFoundMarker, last_found + 1)
        if last_found == -1:
            break  # All occurrences have been found
        else:
            foundcounter += 1
            clear1306()
    printLarge1306(0, 0, 'found ' + str(foundcounter))
    printLarge1306(0, 14, 'viruses')

    if foundcounter > 0:
        printLarge1306(0, 28, 'cleaning...')
        print(repairCommmand + volumeToScan + repairReport)
        os.spawnl(P_WAIT, (repairCommmand + volumeToScan + repairReport))
    return True