def find_late_student():
    try:
        deadline=sys.argv()[1]
        #get the deadline as parameter
    except:
        deadline='09/19/2013 09:12:15'#
    find=0
    for line in file("c:/works/dropbox/Git/data/logsofar.txt"):
        #record the author information, update every time reading a new log
    
        if line.find("Author:")!=-1:
            Author=line[:-1].split(": ")[1]
    
        if line.find("Author:")!=-1:
            Author=line[:-1].split(": ")[1]
            
        #record the data information
        find=line.find("Date:")
        if find!=-1:
            committime=line[:-1].split(":   ")[1]
            time1=time.strptime(committime[:-6],"%a %b %d %H:%M:%S %Y")
            time2=time.strptime(deadline,"%m/%d/%Y %H:%M:%S")
            if time2<time1:
                print Author
                print time1
Exemple #2
0
def usage():
    print ('Usage: \n\t%s i2c_address type\n\t'
           'Send a get to the module on the specified i2c address.\n'
           'Types: Luminosity (1)\n'
           '\tBlinds (2)\n'
           '\tAir conditioner (3)\n'
           '\tTemperature (4)\n'
           '\tLamp (5)\n') % sys.argv([0])
Exemple #3
0
def main():

    if (len(sys.argv) < 7):
        usage()
        sys.exit(2)

    gapfile = sys.argv[1]
    genomefile = sys.argv[2]
    tmpdir = sys.argv[3]
    numshuffles = sys.argv[4]
    shufflefile = sys.argv[5]
   
    print "Your gapfile is [",gapfile,"]"
    print "Your genomefile is [",genomefile,"]"
    print "Your tmpdir is [",tmpdir,"]"
    print "Your numshuffles is [",numshuffles,"]"

    if (not numshuffles.isdigit()):
        usage()
        print "Your numshuffles argument is not an integer!"
        sys.exit(2)

    numshuffles = int(numshuffles)
    print "Your shufflefile is [",shufflefile,"]"
    
 
    if ((len(sys.argv) - 6) % 2 != 0):
        usage()
        print "your arg number is",sys.argv,"! Num of files to be intersected and num outfiles MUST be the same."

        for i in (len(sys.argv) - 6):
            print "arg [",(i+6),"] is [",sys.argv(i+6),"]"

        sys.exit(2) 

    files = sys.argv[6:len(sys.argv)]

    mutex = threading.Lock()

    cmd = ["bedtools", "shuffle", "-chrom", "-excl", gapfile, "-i", shufflefile, "-g", genomefile] 
    tmp = [tmpdir, "/temp_"]

# def __init__(self, IDnum, cmd, tmpcmd, files):

    thread1 = myThread(0, cmd, tmp, files)

    thread1.start()

    threadlist = []
    threadlist.append(thread1)

    for t in threadlist:
        t.join()

    print "Done"

    return
Exemple #4
0
def main():
    if len(sys.argv) <= 1:
        image_folder = "images01"
    else:
        image_folder = sys.argv(1)

    if len(sys.argv) <= 2:
        scale_factor = 5
    else:
        scale_factor = sys.argv(2)

    i = 0
    client = paramiko.SSHClient()
    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    client.connect('vac5', username='******', password='******',
                   allow_agent=False, look_for_keys=False, timeout=5000)

    transport = paramiko.Transport(('vac5', 22))
    transport.connect(username='******', password='******')

    sftp = paramiko.SFTPClient.from_transport(transport)

    os.system("mkdir im")
    local_path = 'im/%d.jpg'
    file_path = '/root/%s/%d.jpg'

    num_storage = 'store.txt'
    client.exec_command('mkdir -p /root/%s' % image_folder)
    while True:
        try:
            im = ImageGrab.grab()
            size = int(im.width/scale_factor), int(im.height/scale_factor)
            im.resize(size, Image.ANTIALIAS).save(local_path % i, 'JPEG')
            sftp.put(local_path % i, file_path % (image_folder, i))  # send via SSH to vac5
            with open(num_storage, 'w') as f:
                f.write(str(i))
                print(i)
            sftp.put(num_storage, '/root/%s/store.txt' % image_folder)
        except Exception as e:
            print(e)
            pass
        i += 1
    sftp.close()
    client.close()
def exclude_genes_in_network(genes_to_keep, network_fullpath, 
                             output_fullpath, header=True):
    '''
    Filter genes in interaction network to only those in a specified gene list.
    This filtered network will be written to file. 
    Inputs:
        genes_to_keep: the output of extract_gene_names_from_textfile() which 
            is a list of gene names.
        output_fullpath: write the filtered network in a new textfile. 
        network_fullpath: textfile of interaction network containing two columns. 
            Each row of two genes represents an interaction event.
            File can contain header (True) or not. Default is true.
        header: is there a header in the network_fullpath? Default True. 
            If True, will also write header in output network.
    Outputs:
        Text file written to output_fullpath of a filtered network that includes
        only genes that we want to keep. 
    '''
    network = read_write_data.read_write(network_fullpath, 
                                         output_fullpath, 
                                         header=header)
    with network:
        # Write column names if header is true
        if header == True:
            network.writenext(network.inputcolnames)
        elif header == False:
            pass
        else:
            sys.argv('Header must be either True or False, %s given' %header)
        while True:
            try:
                readrow = network.readnext()
            except StopIteration:
                print('%s rows read, %s written, breaking loop...' \
                      %(network.readrowcount, network.writerowcount))
                break
            # If both genes in first and second column are in genes to keep,
            # then write row to file. 
            if readrow[0] in genes_to_keep and readrow[1] in genes_to_keep:
                network.writenext(readrow)
    return None
def extract_sentence():

    keywords_list = []
    for ans, X, Y in open(sys.argv(1), "r"):
        keywords_list.append(X)
        keywords_list.append(Y)
    extracted_sentence_list = []

    for line in sys.stdin:
        for keyword in keywords_list:
            if keyword in line:
                extracted_sentence_list.append(line)
                break

    return extracted_sentence_list
def main():
	try:
		script, filepath, appname = sys.argv()
	except:
		print "USAGE: %prog filepath appname"

	if os.path.isfile(filepath):
		sumup(filepath)
	else:
		for root, dirs, files in os.walk(filepath):
			f = [os.path.join(root, fl) for fl in files]
			f.sort(key=lambda x: x.split('.')[0])
			i = 0
			for filename in f:
				result = {}
				result = sumup(filename)
				plot(result, i)
				i += 1
Exemple #8
0
def main():
    stuartWords = 0
    kevinWords = 0
    vowels = {'A': 1,'E': 2,'I': 3,'O': 4,'U': 5}
    inputString = sys.argv(1)  
    length = len(inputString)
    counter = 0
    for e in inputString:
        counter += 1
        if(e in vowels.keys()):
            kevinWords = kevinWords + length - counter + 1
            
        else:
            stuartWords = stuartWords + length - counter + 1
    if(stuartWords>kevinWords):
        print("Stuart",format(stuartWords))      
    elif(kevinWords>stuartWords):
        print("Kevin",format(kevinWords))
    else:
        print("Draw")
Exemple #9
0
def main (args):
	# Read init parameters
	parametersFilename = sys.argv ()
	inputDir, outputDir, nCpus = readParameters (parametersFilename)

	port = 52002
	 
	sock = socket()
	host = 'localhost' # '127.0.0.1' can also be used
	#Connecting to socket
	sock.connect((host, port)) #Connect takes tuple of host and port
	sock.send('STT_SUBSCRIBING:%s:%s:%s:%s:%s' % 
	           (host, port, inputDir, outputDir, nCpus))

	#Infinite loop to keep client running.
	while True:
		data = sock.recv(1024)
		print data
	 
	sock.close()
Exemple #10
0
				cite.addAuthor(line[3:])
			elif authors and line[:2] == "  ": # another author
				cite.addAuthor(line[3:])
			elif authors:
				authors = False
			if line[:2] == "TI": # we're on the title
				title = True
				cite.addTitle(line[])


	def toString(self):
		rstr = "Current infile: {}.{}".format(self.fn, self.ext)
		rstr += "\n"
		rstr += "Current outfile: {}".format(self.outfile)
		return rstr

	def print(self):
		rstr = "Current infile: {}.{}".format(self.fn, self.ext)
		rstr += "\n"
		rstr += "Current outfile: {}".format(self.outfile)
		print(rstr)

def main(filename):
	cList = CiteList(filename)

if __name__ == "__main__":
	args = sys.argv()
	if len(args) < 2:
		print("Input file required.")
		os.exit(0)
	main(args[1])
Exemple #11
0
#! python 3
#The above line will say what version of python is required to run the script

#From the cmd line
#py c:\user\tkonsonlas\documents\hello.py
'''
@py c:\user\tkonsonlas\documents\hello.py %*
@pause
'''

import sys
print('Hello World')
sys.argv()

#the %* says to not show that line and forward provided arguments to python script
#@pyw - This will run a windowless python script
Exemple #12
0
#!/usr/bin/python
# quick read of wiktionary

import urllib
import sys

sys.argv()

prefix="http://en.wiktionary.org/w/index.php?title="
suffix="&action=raw"

print(args)
url="".join([prefix,arg[1],suffix])

f = urllib.urlopen(url)
rawtext=f.read()
f.close()

print(text)

Exemple #13
0
        if n%x == 0:
            divisible == True
        else:
            divisible == False
    return divisible

def colsum(mat, n):
    return sum([x[n] for x in mat])

def charjoiner(begin, end, sep):
    return sep.join([str(x) for x in xrange(begin, end)])


import sys

m = sys.argv(1)
n = sys.argv(2)

def __name__ = '__main__':
    if sys.argv(1) == "iter":
        return fib_iter(n)
    else if sys.argv(1) == "recurse":
        return fib_rec(n)

def fib_rec(n):
    if n == 0 or n == 1: return n
    else:
        return fib_rec(n-2) + fibrec(n-1)

import re
Exemple #14
0
#!/usr/bin/python

import sys
import struct

INF = open(sys.argv(1), 'rb')
BEADSUM = open(sys.argv(2), 'rb')

buffer = INF.read(8)
buffer2 = BEADSUM.read(8)
line0,line1,line2,line3 = struct.unpack('HHHH', buffer)
line4 = struct.unpack('q', buffer2)
line4 = line4[0]
print "%(line0)s\t%(line1)s\t%(line2)s\t%(line3)s\t%(line4)s" %vars()

INF.close()
BEADSUM.close()

"""
while(read(INF, $buffer, 8) and @line = unpack('SSSS', $buffer) and print "$line[0]\t$line[1]\t$line[2]\t$line[3]\t" and read(BEADSUM, $buffer2, 8) and @line = unpack('q', $buffer2) and print "$line[0]\n"){;}
close INF;
close BEADSUM;
"""
Exemple #15
0
import sys
import numpy
import matplotlib.pyplot

if len(sys.argv) i=2
 sys.exit("Expected name of data file plot")
 input_filename = sys.argv (i)
data = numpy.loadtxt(fname='data/inflammation-01.csv', delimiter=',')

fig = matplotlib.pyplot.figure(figsize=(10.0, 3.0))

axes1 = fig.add_subplot(1, 3, 1)
axes2 = fig.add_subplot(1, 3, 2)
axes3 = fig.add_subplot(1, 3, 3)

axes1.set_ylabel('average')
axes1.plot(data.mean(axis=0))

axes2.set_ylabel('max')
axes2.plot(data.max(axis=0))

axes3.set_ylabel('min')
axes3.plot(data.min(axis=0))

fig.tight_layout()

matplotlib.pyplot.show(fig)
Exemple #16
0
def generate_images_t(X, W, S, z_len, max_from_each=(sys.maxint - 1)):
    # W_inv = np.linalg.pinv(W)
    all_images = [None] * len(X)
    for label, x_label in enumerate(X):
        x_for_label = [None] * len(x_label)
        for i, x in enumerate(x_label):
            x_for_label[i] = Image_t(label, x, W, S)
        all_images[label] = x_for_label
    return all_images


def main(fname='./mnest_train.csv'):
    t0 = time.clock()
    x_len = columns(fname) - 1
    y_len = int(x_len / 2)
    z_len = int(2 * x_len)
    W = np.matrix(generate_random_matrix(z_len, x_len))
    S = np.matrix(generate_random_matrix(x_len, y_len))
    print time.clock() - t0
    X = prep_data(fname, prep_data_fn=slist_2_npmatrix)
    print time.clock() - t0
    images_t = generate_images_t(X, W, S, z_len, max_from_each=100)
    print time.clock() - t0

    return images_t, W, S


if __name__ == '__main__':
    main(sys.argv(1))
Exemple #17
0
                    dimsLogged = True
        return FRM


def find_nearest(array, value):
    array = np.asarray(array)
    distance = np.abs(array - value)
    idx = (distance).argmin()
    shortestDistance = min(distance)
    return (int(idx), shortestDistance)


if __name__ == '__main__':
    #gribFile = 'oceanWave_cop_climate_2018_Nov_01_to_02.grib'
    #gribFile = '20181002_20181009.grib'
    #LatLonTimeFile = 'ShipTrack.csv'
    try:
        gribFile = sys.argv()[1]
        LatLonTimeFile = sys.argv()[2]
    except:
        print('Error: Not enough input arguments \n'\
         +'ensure two arguments are passed like:\n'\
         +'\t wamIntermQuery.py \'example.grib\' \'example.csv\' ')
        sys.exit(0)
    Frm = QueryGrib(gribFile, LatLonTimeFile)
    if Frm != -1:
        FRM = pd.DataFrame(Frm)
        FRM.to_csv('CDS_data.csv')
    else:
        sys.exit(0)
Exemple #18
0
import capo.omni as omni
import numpy as n, pylab as p, capo.plot as plot
import sys


args = sys.argv()[1:]

m,g,v,x = omni.from_npz(args, verbose=True)
    
Exemple #19
0
# 如果出现了异常,也不好排查,取名就是分成大的问题

#可以将的很多功能相似的函数可以放在同一个模块中,

# 模块和包 作用:
#  1.便于代码的管理
#  2.有利于取名
#  3.写好一个模块之后可以在其他需要的地方调用,提高代码的复用性

# 调用 模块种类:
# 内置模块:time
# 第三方模块:pymysql
# 自定义模块:

#通过sys模块可以接受执行脚本的时候传入的参数

import sys
a = sys.argv()

print(a)










Exemple #20
0
# exercise 13

from sys import argv

# print argv

script = argv(0)

txt = open(script)

print txt.read()

txt.close()

# script, first_name, last_name = argv
#
# print "The scrips is called: ", script
# print "Your first name is:", first_name
# print "Your last name is:", last_name
Exemple #21
0
#! python3
# pw.py - An insecure password locker program.

PASSWORDS = {'email': 'ABCDefgh', 'blog': '1029384756', 'other': 'dfgHJK'}

import sys, pyperclip

if len(sys.argv) < 2:
    print('Usage: python pw.py [account] - copy account password')
    sys.exit()

account = sys.argv(1)

if account in PASSWORDS:
    pyperclip.copy(PASSWORDS[account])
    print('Password for ' + account + ' copied to clipboard.')
else:
    print('There is no password stored for ' + account + '.')
Exemple #22
0
# General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
####
## 
## Aggregate the layers of a multiplex, weigthing each edge according
## to the number of times it occurs in the different layers
##

import sys
import networkx as net


if len(sys.argv) < 3:
    print "Usage: %s <file1> <file2> [<file3>....]" % sys.argv(0)
    sys.exit(1)

G = net.Graph()

lines = open(sys.argv[1], "r").readlines()

for l in lines:
    s,d = [int(x) for x in l.strip(" \n").split(" ")[:2]]
    G.add_edge(s,d)
    G[s][d]['weigth'] = 1

for f in sys.argv[2:]:
    lines = open(f, "r").readlines()
    for l in lines:
        s,d = [int(x) for x in l.strip(" \n").split(" ")[:2]]
Exemple #23
0
"""
This script prints the arguments provided to Python.
"""
import sys

print(sys.argv())
Exemple #24
0
#
# -*- coding: utf-8 -*-

import sys

if __name__ == "__main__":

    param = sys.argv()

    print (param)

    print (u"param1" + param[1])
    print (u"param2" + param[2])
    print (u"param3" + param[3])
Exemple #25
0
import os, glob, sys #импортируем необходимые модули
dirname = r'You path here..' if len(sys.argv) == 1 else sys.argv([1])#
allsizes = []#создаем пустой список имен
allpy = glob.glob(dirname + os.sep + '*.py')#получаем список файлов в указаном путе
for filename in allpy:
    filesize = os.path.getsize(filename)#определяем размер файла
    allsize.append((filesize, filename))#добавляем файл в список

allsizes.sort()#сортировка списка файлов
print(allsizes[:2])#самый легкий файл
print(allsizes[-2:])#самый тяжелый файл
Exemple #26
0
            continue
        yest_close = df.iloc[0].price - df.iloc[0].change
        opengap = df.iloc[0].price / yest_close - 1
        idxmin = df_5min.price.idxmin()
        idxmax = df_5min.price.idxmax()
        min_time = df_5min.loc[idxmin].time
        max_time = df_5min.loc[idxmax].time
        dtime = (df_5min.iloc[-1].time - min_time) / datetime.timedelta(minutes=1)
        dprice = df_5min.iloc[-1].price - df_5min.loc[idxmin].price
        amount = df_5min.loc[idxmin:].amount.sum()
        up_speed  = dprice/yest_close
        dtime = (df_5min.iloc[-1].time - max_time) / datetime.timedelta(minutes=1)
        dprice = df_5min.iloc[-1].price - df_5min.loc[idxmax].price
        down_speed = dprice/yest_close
        chg = df_5min.iloc[-1].price / yest_close - 1
        if up_speed > 0.02 and down_speed == 0:
            df_res.loc[exsymbol] = [up_speed, down_speed, chg, amount, opengap]
    return df_res

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: {} <date>".format(sys.argv(0)))
        sys.exit(1)

    pd.set_option('display.max_rows', None)
    date = sys.argv[1]

    #df_res = filter_speed(date)
    df_res = filter_close(date)
    print(df_res.sort_values("up_speed"))
Exemple #27
0
import os
import re
import sys

from collections import defaultdict
path = sys.argv(0)
print path
block = [filename for filename in os.listdir(path) if filename[0] == "@"]

for filename in block:
    print filename
    data = defaultdict(list)
    header = ""
    if filename.startswith('@spikes'):
        with open(path + filename, 'r') as f:
            header = f.readline()
            for line in f:
                if re.match(" *\d", line):
                    time = float(re.search('\d+\.\d', line).group(0))
                    neurons = re.search("\[[\d, ]+\]", line).group(0).translate(None, ''.join(['[',']']))
                    for s in neurons.split(','):
                        data[time].append(int(s))
        with open(path + filename, 'w') as f:
            f.write(header)
            for key in data:
                f.write("{0:>5} {1:>4} : {2}\n".format(key, len(data[key]), sorted(data[key])))
    else:
        print "@voltage not implemented"
Exemple #28
0
from import_config import get_config
import sys


def main(env):
    config = get_config(env)
    print config


if __name__ == '__main__':
    if len(sys.argv) > 1:
        env = sys.argv(1)
    else:
        env = 'TEST'
    main(env)
Exemple #29
0
    global k
    for p in primes:
        if covers_all(richards, p):
            print "Witness %s" % p
            return False
    return True


k = 10000 #341640 # default for k

# bounds on m
start = 360
end = 385

if len(sys.argv) > 1:
    k = sys.argv(1)

primes = sorted(make_primes(k), reverse=True) # primes 2 < p < k
l = len(primes) # primes[i] = p_{l + 1 - i}

natural_primes = make_primes(int(math.log(k)*k)) # primes 2 < p, natural_primes[i] = p_{i+2}

# For a given k, find a set H subject to:
# |H|=k
# diam(H) is small
# H doesn't cover any p

last_witness = None
last_set = None
last_remove = None
Exemple #30
0
def __name__ = '__main__':
    if sys.argv(1) == "iter":
        return fib_iter(n)
    else if sys.argv(1) == "recurse":
        return fib_rec(n)
import sys 

print("This was the arguement you entered: " = sys.argv({1}) 
import sys
NewYorkHours = sys.argv(1)
NewYorkMinutes = sys.argv(2)
Exemple #33
0
    return {
        'vars': unique_vars,
        'dates': [d.isoformat() for d in dates],
        'array var count': array_var_count,
    }


if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description='Dump the metadata of a grib 2 file')
    parser.add_argument('filename',
                        metavar='F',
                        type=str,
                        help='path to grib file to process')
    args = parser.parse_args()

    messages = grippy.message.read_messages(args.filename)
    if len(messages) == 0:
        print('Failed to extract grib2 data from ' + args.filename +
              ' . Make sure the file is valid and try again')
        sys.argv(1)

    metadata = extract_metadata(messages=messages)
    print('Grib Metadata for ' + args.filename + ':')
    print('------------------------------------------------')
    print('Array Variable Count: ' + str(metadata['array var count']))
    print('Variables (' + str(len(metadata['vars'])) + ') ' +
          ','.join(metadata['vars']))
    print('Dates: (' + str(len(metadata['dates'])) + ') ' +
          ','.join(metadata['dates']))
Exemple #34
0
import sys
import numpy
import matplotlib.pyplot

if lens(sys.argv) !=2:
  sys.ext("expected the the name of a data file to plot")
import_filename =sys.argv(1)
data = numpy.loadtxt(fname='data/inflammation-01.csv', delimiter=',')

fig = matplotlib.pyplot.figure(figsize=(10.0, 3.0))

axes1 = fig.add_subplot(1, 3, 1)
axes2 = fig.add_subplot(1, 3, 2)
axes3 = fig.add_subplot(1, 3, 3)

axes1.set_ylabel('average')
axes1.plot(data.mean(axis=0))

axes2.set_ylabel('max')
axes2.plot(data.max(axis=0))

axes3.set_ylabel('min')
axes3.plot(data.min(axis=0))

fig.tight_layout()

matplotlib.pyplot.show(fig)
##my demo edit
Exemple #35
0
print "Juego Piedra, papel o tijera"
import numpy 
import sys

pie=0
pap=1
tij=2

U=sys.argv(1)
print U
if (U==pie):
    print "Piedra"
if (U==pap):
    print "Papel"

if (U==tij): 
    print "Tijeras"

C=np.random int(:3)
print C
Exemple #36
0
from PIL import Image
import os
import sys

try:
    filename = sys.argv(1)
except:
    filename = '5.jpg'

try:
    outfilename = sys.argv(2)
except:
    outfilename = 'out.jpg'

try:
    orientation = True
except:
    prientation = False

im = Image.open(filename)
if orientation is True:
    out = im.resize((400,300))
else:
    out = im.resize((300,400))
    
out.show()
out.save(outfilename)
Exemple #37
0
from sys import argv

funny_name = argv(2)

print "Do you think \'%r\' is a funny name" % funny_name
import sys 


intArgument = int(sys.argv({1})


print(10 + intArgumen)
Exemple #39
0
  c = the image number    ([0..IMGS_PER_ARRAY])

Written in Perl by Greg Porreca (Church Lab) 12-14-2007
Translated to Python by David Kalish 11-30-2010
"""

import sys
import numpy
import glob
import re
import struct

num_arrays = 8
num_imgs = 2180
reg_pixels = 2000
num_args = len(sys.argv())-1

if num_args < 3:
    print >> stderr, "ERROR:\tMust call as ./pull_segpoints fcnum arraynum imgnum %(num_args)s" %vars()

fc = sys.argv(1)
array = sys.argv(2)
img = sys.argv(3)

# OUTPUT WILL BE BINARY IMAGE W/ 1s AT BEAD PIXELS
image = numpy.zeros((1000,1000), dtype = int)

print >> stderr, "Seeking to position %(fc)s %(array)s %(img)s..." %vars()

# DETERMINE INFO AND SEG FILENAMES
array = glob.glob("*.info")
Exemple #40
0
def process_url(url):
    print 'process', url
    res = get_content(url)
    if res.status_code != 200:
        print 'error getting content from ', url
        exit()

    return is_available(res.text)

def send_notify(url, email, is_avail):
    if is_avail:
        msg = MIMEText("%s is showing availability!" % (url))
        msg["From"] = email
        msg["To"] = email
        msg["Subject"] = "warm up your credit card, son"
        p = Popen(["/usr/sbin/sendmail", "-t"], stdin=PIPE)
        p.communicate(msg.as_string())

def main(url, notify_email):
    result = process_url(url)
    send_notify(url, notify_email, result) 


if __name__ == '__main__':
    if len(sys.argv) != 3:
        print 'usage: python nxs4dsr.py {URL} {NOTIFY_EMAIL}'
    main(sys.argv[1], sys.argv(2))


#'''

import rosbag, sys, csv
import time
import string
import os #for file management make directory
import shutil #for file management, copy file

#verify correct input arguments: 1 or 2
if (len(sys.argv) > 2):
	print "invalid number of arguments:   " + str(len(sys.argv))
	print "should be 2: 'bag2csv.py' and 'bagName'"
	print "or just 1  : 'bag2csv.py'"
	sys.exit(1)
elif (len(sys.argv) == 2):
	listOfBagFiles = [sys.argv(1)]
	print "reading only 1 bagfile: " + str(listOfBagFiles(0))
elif (len(sys.argv) == 1):
	listOfBagFiles = [f for f in os.listdir(".") if f[-4:] == ".bag"]	#get list of only bag files in current dir.
	numberOfFiles = str(len(listOfBagFiles))
	print "reading all " + numberOfFiles + " bagfiles in current directory: \n"
	for f in listOfBagFiles:
		print f
	print "\n press ctrl+c in the next 10 seconds to cancel \n"
	time.sleep(10)
else:
	print "bad argument(s): " + str(sys.argv)	#shouldnt really come up
	sys.exit(1)

count = 0
for bagFile in listOfBagFiles:
Exemple #42
0
def main(argv=None):
    if argv is None:
        argv = sys.argv()
    print parsesites(argv[0] ,argv[1])
Exemple #43
0
import sys

print(sys.argv)

if len(sys.argv) != 2:
    print('Input video name is missing')
    exit()

cv2.namedWindow("tracking")

captureInput = 0

try:
    captureInput = int(sys.argv[1])
except ValueError, ve:
    captureInput = sys.argv([1])

camera = cv2.VideoCapture(captureInput)

ok, image=camera.read()
if not ok:
    print('Failed to read video')
    exit()
bbox = cv2.selectROI("tracking", image)
tracker = cv2.TrackerMIL_create()
init_once = False

while camera.isOpened():
    ok, image=camera.read()
    if not ok:
        print 'no image to read'