jice 53 Posting Whiz in Training

my bad, the code i got is:

input.csv
1,2,text, date, qwertyuiopasdfghjklñzxcvbnm, yhnujmik,2121212121

import csv

reader = csv.reader(open('input.csv', 'rb'), delimiter=',',quoting=csv.QUOTE_NONNUMERIC))
csv_out = csv.writer(open('output.csv', 'w'))


for row in reader:
	content = row[0] + row[1] +  row[5] +  row[6] 
	csv_out.writerow( content )

which is giving me: 1,2,y,h,n,u,j,m,i,k,2,1,2,1,2,1,2,1,2,1 instead of 1,2,yhnujmik,2121212121

thanks!

Ok with Gribouillis.
Just to modify your code to make it work :

import csv

reader = csv.reader(open('input.csv', 'rb'), delimiter=','))
csv_out = csv.writer(open('output.csv', 'w'))


for row in reader:
	content = [row[0], row[1],  row[5],  row[6]]
	csv_out.writerow( content )
jice 53 Posting Whiz in Training

Thanks for posting your result.
It's always useful to see the result of searching...

jice 53 Posting Whiz in Training

oups 2

shutil.copy2(os.path.join(root, one_file), dst_subdir)
jice 53 Posting Whiz in Training

oups :

src_dir, patterns = line.strip().split(";")
jice 53 Posting Whiz in Training

First of all, I can't understand why you need to add

- app\source

as all the dirs you want to include are listed...

Anyway, i don't see how you can manage your need only with glob so i'll explain it with the old fashioned method I use.

First of all, unless you really need your dir list to be formatted as you posted it, i would do this another way :

On each line, you put the dir to be listed (those that don't need to be listed simply don't need to be in the file)
then, separated with some character (i'll use ";" because it's easier to see than tab) the patterns of your files you want to list (+) or not (-).
You'll never have a + and a - as if you choose to select only some files (+), those you want to exclude won't be in the list (normally)
Anyway, using this method, you can imagine to add other ';' and add other informations in it.

Note : For my very complicated backup scripts, i even use yaml ini files and put plenty of parameters to select very precisely the files i want to backup (drawback : the ini file is long to elaborate)

So here is the look of the file :

app\bin;-.txt,.log
app\docs
app\manuals;-.xls
app\source;+.py

Notice that in the first line lists 2 ext patterns separated by "," but this could be whatever you …

jice 53 Posting Whiz in Training

Hi,
You can use () to make it work (if you really want a one liner)...

def l():
    return (lambda ...)()
def l():
    return (lambda x=input("Enter the text to be decrypted: "),y=int(input("Enter the shift amount: ")): print("The decrypted text is: "+"".join(list(map(lambda x: chr(ord(x)+y),x)))))()
jice 53 Posting Whiz in Training

You're right... glob is a very convenient way to deal with files and dirs.
But I'm so used to use os.walk and fnmatch that i hardly never use glob (but i should).
I'll come back on your questions tomorrow but what i can say about the last one is that you can use os.path.isdir(your_path) (see http://docs.python.org/library/os.path.html)
something like :

for one_line in open(my_file):
    my_glob = one_line.strip()
    if os.path.isdir(my_glob):
        my_glob = os.path.join(my_glob, "*.*")

The problem i can see with your way is that i don't think you can remove "*.txt" files using glob. This maybe one reason to use the old style method i use.
I'll look at that tomorrow

jice 53 Posting Whiz in Training

Thank you for your feedback

jice 53 Posting Whiz in Training

If you're interested in generators (and you should be), here is the link that made me use generators and list comprehension:
http://www.dabeaz.com/generators/Generators.pdf

TrustyTony commented: Great reference on generators! +3
jice 53 Posting Whiz in Training

Sorry for this late reply...

Some comments :
1. The comment IN the function. This becomes a docstring and is used to document your programs.

2. I don't understand how this work :
"-" dirs are ignored so why are they in the file ?
Your file can contain only the dirs you want to copy so that you don't need to deal with the "+" and "-". Your code will be much simpler (you won't need a function to read the file)

Your function doesn't return anything... so what is the function used for ?

cpfolders only contains the last line so how do you want your main program to copy each dir ?
Note : This would be possible if your function is a generator but i don't think you ment it to be one...
Here is the code to make your function work as a generator (look for python generator on google to have more details)

myfile1 = "/home/user/locationoffile/filedirlist.txt"
# For myfile, i'd just affect the name to the variable and open it in the function.
# In your code, i can't see the closing of the file.
# When you do like I did, the closing is implicit at the end of the loop.

def readSource(myfile1):
    """This function reads the .txt file"""
    for line in open(myfile1):
        if line.startswith('-'):  #lines to ignore
            continue
        else:
            cpfolder = line.strip('+ \n') #strip the + and empty lines from the list …
jice 53 Posting Whiz in Training

an example of code

import os
import os.path
import shutil
import fnmatch

list_of_dirs_to_copy = ['path/to/dir/1', 'path/to/dir/2'] # List of source dirs
excluded_subdirs = ['dir1', 'dir2']  # subdir to exclude from copy
dest_dir = 'path/to/my/dest/dir'     # folder for the destination of the copy
files_patterns = ['*.txt', '*.doc']
for root_path in list_of_dirs_to_copy:
    for root, dirs, files in os.walk(root_path): # recurse walking
        for dir in excluded_subdirs:
            if dir in dirs:
                dirs.remove(dir)   # remove the dir from the subdirs to visit
        if not os.path.exists(dest_dir):
            os.makedirs(dest_dir)  # create the dir if not exists
        for pattern in files_patterns:
            for thefile in fnmatch.filter(files, pattern):  # filter the files to copy
                shutil.copy2(os.path.join(root, thefile), dest_dir) #copy file
jice 53 Posting Whiz in Training

I'll give you more details tomorrow...
But it would be easier if you post some code you've done and precise the situation (what is the content of folder.txt file, which files are to be copied, which are not...)
As your question is general, i gave you general ideas you can use for your particular problem...
Anyway, you can easily google for examples of each of the functions I gave you.
They are not very difficult to understand.

jice 53 Posting Whiz in Training

Here are some function you can look at :
- os.listdir(mydir) will list all the files from "mydir"
- fnmatch.filter(files_list, "*.txt") will give you a list of all text files in the files_list (tip : fnmatch.filter(os.listdir(mydir))
- os.path.join(mydir, file) will give you the absolute name of the file
- os.walk(mydir) will list mydir and all its subdirs, giving you a tuple (root, dirs, files) where root is the current dir, dirs, the subdirs and files the files of the current dir. Tip : if you remove dir from dirs, it won't be visited.

jice 53 Posting Whiz in Training

This should work (not tested)

of = open(my_out_filename, 'w')
for line in open(my_in_filename,'r'):
    if 'STRING' in line or 'INTEGER' in line:
        of.write(line)
of.close()
jice 53 Posting Whiz in Training

Are you kidding ?
It's just the example I gave 5 post ago !

jice 53 Posting Whiz in Training

Have you tried the examples we gave you ?
Did you simply read them carefully ?
To me, all examples given allow what you've asked for !

jice 53 Posting Whiz in Training

My 2 cents
To use csv with other dialect and use dict(zip()) instead of named tuple.

"""
datas.csv :
"123"; "gishi"; "gishi@mymail.com"; "456 happy st."
"345"; "tony"; "tony.veijalainen@somewhere.com"; "Espoo Finland"
"""
import csv
class excel_french(csv.Dialect):
    delimiter=';'
    quotechar='"'
    doublequote=True
    skipinitialspace=False
    lineterminator='\n'
    quoting=csv.QUOTE_MINIMAL

csv.register_dialect('excel_french', excel_french)

header=['id', 'name', 'email', 'homeaddress']
d={}
for row in csv.reader(open('datas.csv'), 'excel_french'):
    drow=dict(zip(header, row))
    d[drow['id']]=drow
print d

>>>
{'123': {'email': ' "gishi@mymail.com"',
         'homeaddress': ' "456 happy st."',
         'id': '123',
         'name': ' "gishi"'},
 '345': {'email': ' "tony.veijalainen@somewhere.com"',
         'homeaddress': ' "Espoo Finland"',
         'id': '345',
         'name': ' "tony"'}}

If the first row of the file is the header line :

"""
datas.csv :
"id"; "name"; "email"; "homeaddress"
"123"; "gishi"; "gishi@mymail.com"; "456 happy st."
"345"; "tony"; "tony.veijalainen@somewhere.com"; "Espoo Finland"
"""
import csv
class excel_french(csv.Dialect):
    delimiter=';'
    quotechar='"'
    doublequote=True
    skipinitialspace=False
    lineterminator='\n'
    quoting=csv.QUOTE_MINIMAL

csv.register_dialect('excel_french', excel_french)

d={}
for i, row in enumerate(csv.reader(open('datas.csv'), 'excel_french')):
    if i==0:
        header=row
    else:
        drow=dict(zip(header, row))
        d[drow['id']]=drow
print d
jice 53 Posting Whiz in Training
import csv

reader = csv.reader(open("c:\sample.dat"))

d={}
for row in reader:
    d[row[0]]=row[1:]
jice 53 Posting Whiz in Training

sorry

print o

> my name is toto
jice 53 Posting Whiz in Training

Just a quick point.
To turn an object into string, you can define the special method __repr__ in your object :

class myobject:
    def __init__(self, name):
        self.name=name

    def __repr__(self):
        return "my name is %s" % (self.name)

o=myobject("toto")

print o

> toto
jice 53 Posting Whiz in Training

A better way to deal with text files is rather with for loop :

of=open(myoutfilename, 'w')
for line in open(myfilename,'r'):
    print line
    of.write(line.replace(' ', '\t'))
of.close()

######### OR ##############
# not sure the 2 with on the same line work (and i can't test it right now)
# this would be a preferred way (even if i use the first one)

with open(myfilename,'r') as f, with open(myoutfilename,'w') as of:
    for line in f:
        print line
        of.write(line.replace(' ', '\t'))

if replacing the spaces is enough in your case

jice 53 Posting Whiz in Training

It's because your class isn't "tennisPro", it's "tennis"

jice 53 Posting Whiz in Training

wherever you write :

something("%s") % one_variable

write

something("%s" % one_variable)
jice 53 Posting Whiz in Training

Sorry, i've been too fast

import pprint # don't worry abour this it is only to print the result quickly at the end

rows=[[0 for i in range(9)] for i in range(9)]
cols=[[0 for i in range(9)] for i in range(9)]
# these are called list comprehensions and are the same as
rows=[]
for i in range(9):
    rows.append([])
    for j in range(9):
        rows[-1].append(0)
# so now rows=[[0, 0, 0, 0... ], [0,0,0,0...  ] ... ]
cols=[]
for i in range(9):
    cols.append([])
    for j in range(9):
        cols[-1].append(0)
# this is to create 2 lists skeltons
# now, let's fill them
for i in range(9):
    for j in range(9):
        # here, instead of 0 in each 'cell', I put a dictionary with 1 key : 'value'
        # note that you can put others datas in this dictionnary (like hidden, shown or whatever)
        rows[i][j]={"value":(i+j) % 9 + 1} # I put whatever value. Call another function... It's here you choose the values
        cols[j][i]=rows[i][j] # cols[j][i] and rows[i][j] are the SAME object
                              # altering one will alter the other

# Here is the print section.
# I use the pprint module and list comprehension to be quick on this part.
# This doesn't need to be understood ;-)
pprint.pprint([[elt["value"] for elt in row] for row in rows])
pprint.pprint([[elt["value"] for elt in col] for col in cols])

print 
# WHAT IS IMPORTANT TO SEE IS HERE
rows[3][4]["value"]=1515
# I change a rows value and in the result, you'll see that cols have changed too …
jice 53 Posting Whiz in Training

Something to think abour is also to use objects as cells (dict for example)
This way, you can use several lists to order the same cells different way.

For example

import pprint # don't worry abour this it is only to print the result quickly at the end

rows=[[0 for i in range(9)] for i in range(9)]
cols=[[0 for i in range(9)] for i in range(9)]
for i in range(9):
    for j in range(9):
        rows[i][j]={"value":(i+j) % 9 + 1}
        cols[j][i]=rows[i][j] # cols[j][i] and rows[i][j] are the SAME object
                              # altering one will alter the other

# Here is the print section.
# I use the pprint module and list comprehension to be quick on this part.
# This doesn't need to be understood ;-)
pprint.pprint([[elt["value"] for elt in row] for row in rows])
pprint.pprint([[elt["value"] for elt in col] for col in cols])

print 
rows[3][4]["value"]=1515

pprint.pprint([[elt["value"] for elt in row] for row in rows])
pprint.pprint([[elt["value"] for elt in col] for col in cols])

I didn't build the lists for the squares as it is a little more complicated and of no use for this example.
When you've done this, it is very quick and to verify all your groups...

jice 53 Posting Whiz in Training

You can do a list of lists...

rows=[[],[],[]...]
# you call a particular cell by doing
rows[3][4]
jice 53 Posting Whiz in Training

give me 40 mintues, i use this code ... ;]

This second code is only to help to find the good encoding (this is the hardest part)... Not to translate your whole file... It takes each encoding format and try to translate. If there is an exception, it writes "error".
The output shows you which encoding succeeds in encoding your file.

If the first programme raises an exception, you certainly have something wrong :
- the encoding line (# -*- coding: utf-8 -*-) MUST be consistant with the file encoding and the .decode() part of the commands.
- you've got some characters I hadn't in the string i used for my test and which isn't supported by "iso8859_13". If so, you can use the second part of my code to try to find another encoding format...

Hope this helps... Encoding is really tricky...

jice 53 Posting Whiz in Training

So I explored a little my solution (which may not be the simplest).
In your case, you have to use an encoding parameter which is using the same length to encode all the polish characters. It seems to be iso-8859-13 as mentionned here
standard-encodings
So, my example becomes :

# -*- coding: utf-8 -*-
import string
a='ąóęśłżźćńĄÓĘŚŁŻŹĆŃ' ## utf8 has variable number of bytes
b='aoeslzzcnAOESLZZCN'

t = string.maketrans(a.decode("utf8").encode('iso8859_13'),b.decode("utf8").encode('iso8859_13'))

print 'ąóęśłżźćńĄÓĘŚŁŻŹĆŃ'.decode("utf8").encode('iso8859_13').translate(t).encode("utf8")
# .decode("utf8").encode('iso8859_13') : decodes the preceeding string using the utf-8 encoding and encodes it in a fixed length encoding defining the letters you need
# .translate(t) translates the string using the rule you mentionned
# .encode("utf8") reencodes (if needed) the result (here encoded in iso8859_13) in utf8

When you're not sure of which encoding you should use, you can try this code :

# These are all the standards encodings
encs=['ascii', 'big5', 'big5hkscs', 'cp037', 'cp424', 'cp437', 'cp500', 'cp737', 'cp775', 'cp850', 'cp852', 'cp855', 'cp856', 'cp857', 'cp860', 'cp861', 'cp862', 'cp863', 'cp864', 'cp865', 'cp866', 'cp869', 'cp874', 'cp875', 'cp932', 'cp949', 'cp950', 'cp1006', 'cp1026', 'cp1140', 'cp1250', 'cp1251', 'cp1252', 'cp1253', 'cp1254', 'cp1255', 'cp1256', 'cp1257', 'cp1258', 'euc_jp', 'euc_jis_2004', 'euc_jisx0213', 'euc_kr', 'gb2312', 'gbk', 'gb18030', 'hz', 'iso2022_jp', 'iso2022_jp_1', 'iso2022_jp_2', 'iso2022_jp_2004', 'iso2022_jp_3', 'iso2022_jp_ext', 'iso2022_kr', 'latin_1', 'iso8859_2', 'iso8859_3', 'iso8859_4', 'iso8859_5', 'iso8859_6', 'iso8859_7', 'iso8859_8', 'iso8859_9', 'iso8859_10', 'iso8859_13', 'iso8859_14', 'iso8859_15', 'iso8859_16', 'johab', 'koi8_r', 'koi8_u', 'mac_cyrillic', 'mac_greek', 'mac_iceland', 'mac_latin2', 'mac_roman', 'mac_turkish', 'ptcp154', 'shift_jis', 'shift_jis_2004', 'shift_jisx0213', 'utf_32', 'utf_32_be', 'utf_32_le', 'utf_16', 'utf_16_be', 'utf_16_le', 'utf_7', 'utf_8']
for e in encs:
    try:
        t = string.maketrans(a.decode("utf8").encode(e),b.decode("utf8").encode(e))
        print "%s : %s" % (e, 'ąóęśłżźćńĄÓĘŚŁŻŹĆŃ'.decode("utf8").encode(e).translate(t).encode("utf8")) …
Gribouillis commented: Nice. I didn't think it was possible with translate. +3
jice 53 Posting Whiz in Training

Sorry for not having been here for some days...
Gribouillis' solution is probably better.
I have used the one i told you some times but I always have problems to adjust encoding and decoding parameters...
To help you, i need your errors messages...

jice 53 Posting Whiz in Training

What's the error message ?
Probably a decoding encoding problem...
try things like

t = string.maketrans('ąóęśłżźćńĄÓĘŚŁŻŹĆŃ'.decode("utf8").encode("latin1"), 'aoeslzzcnAOESLZZCN').decode("utf8").encode("latin1"))
jice 53 Posting Whiz in Training

Problem 1 (done with python 2.4)

# -*- coding: latin-1 -*-
# The first line is important and must be consistant with your file encoding (maybe utf8)
import string
t=string.maketrans('àéèëêôöîïù', 'aeeeeooiiu') 
print "lévitèrent à l'ïstrùmen".translate(t)

for python 3.1

# -*- coding: latin-1 -*-
t=str.maketrans('àéèëêôöîïù', 'aeeeeooiiu')
print ("lévitèrent à l'ïstrùmen".translate(t))

problem 2

mylist=[]
for i in range(10):
    mylist.append([])
    for j in range(1,9,2):
        mylist[i].append(j)
print mylist

# same result with list comprehension
print [[i for i in range(1,9,2)] for i in range(10)]
jice 53 Posting Whiz in Training

Here is some kind of skeleton to copy your files (you'll have to adapt it but the principle is here) :

import os, fnmatch, shutil
mydir="/path/to/my/dir/"
for filename in fnmatch.filter(os.listdir(mydir),'*.py'):
    shutil.copy(filename, "anotherDir/new-%s" % filename)

Note that if you want to explore the dir recursively, you can do:

for subdir, dirs, files in os.walk(mydir):
    for filename in files:
        shutil.copy(os.path.join(subdir, filename), "anotherDir/%s/new-%s" % (subdir.replace(mydir,""), filename)) # not tested but certainly close ;-)
jice 53 Posting Whiz in Training

2 more solutions using dict()

datas="""Avenue,Av
Road,Rd
South East,SE
Terrace,Tce""".split("\n")

# The shortest way :
print dict([(l.split(",")[0], l.split(",")[1]) for l in datas])

# a more understandable way
lst=[]
for l in datas:
    sl=l.split(",")
    lst.append((sl[0], sl[1]))
d=dict(lst)
print d
jice 53 Posting Whiz in Training

I can see 2 solutions :

list1 = ["20100122 http google.com 200", "20100124 http hushmail.com 200", "20100123 http microsoft.com 404" ]
list2 = ["google.com", "yahoo.com", "msn.com", "hotmail.com", "gmail.com"]
# 1
for i, e1 in enumerate(list1):
    for e2 in list2:
        if e2 in e1:
            print ("line %d : %s" % (i,e1))

# 2
for i,e in enumerate(list1):
    d=e.split()[2]
    if d in list2:
        print ("line %d : %s" % (i,e))

Note that I don't understand where your microsoft output line comes from.

jice 53 Posting Whiz in Training
if x != int(x):

This will tell you whether x is an int or not but should raise a ValueError if x is a non digit string ('a' for example) and will be false is x is a digit string ('6' != 6)

What you want to do is rather something like

if str(x).isdigit():

this will convert x in string (which will stay the same if x is already a string (no exception)) and will look if every character is a digit.

jice 53 Posting Whiz in Training

You should use modules like pickle or marshal to serialize and load your datas

import pickle
c=['Hondros', {'Equiped': [['none', [], 0], ['Rags', [0, 1, 0, 0], 1, 1], ['Mocassins', [0, 0, 1, 0], 1, 1], ['Gauntlets', [0, 0, 0, 1], 6, 5]], 'Equipment': [0, 1, 1, 1], 'Stats': {'AC': 14, 'Strength': 15, 'Constitution': 14, 'Level': 1, 'HP': 12, 'Experience': 0, 'Dexterity': 12, 'Intelligence': 12, 'Base AC': 8, 'Wisdom': 11, 'HP max': 12}, 'Inventory': [], 'Gold': 0}]
f=open('test.pkl','wb')
pickle.dump(c, f)
f.close()
f=open('test.pkl','rb')
d=pickle.load(f)
f.close()
print d[1]['Stats']

Eventually, you can use exec but this is not to be recomended

a = "['Hondros', {'Equiped': [['none', [], 0], ['Rags', [0, 1, 0, 0], 1, 1], ['Mocassins', [0, 0, 1, 0], 1, 1], ['Gauntlets', [0, 0, 0, 1], 6, 5]], 'Equipment': [0, 1, 1, 1], 'Stats': {'AC': 14, 'Strength': 15, 'Constitution': 14, 'Level': 1, 'HP': 12, 'Experience': 0, 'Dexterity': 12, 'Intelligence': 12, 'Base AC': 8, 'Wisdom': 11, 'HP max': 12}, 'Inventory': [], 'Gold': 0}]"
exec("b=" + a)
print b[1]['Stats']
jice 53 Posting Whiz in Training

doing
x=Stuff
make of x an alias to the Stuff class.
Try this :

class Test:
    def __init__(self):
        self.a="a"

x=Test
print x
y=x()
print y.a

This may be useful if you want to pass an object definition as an argument for a function. Never happened to me yet but it may be interesting in some case...
What "often" happens is to pass a function (without ()) as an argument of a function of another object. This is known as callback. Search the web for more information about callbacks...

jice 53 Posting Whiz in Training

My 2 cents...
1 - I prefer for loop than while ones when I can (less code to write and no infinite loops).

start = int(raw_input("Start at: "))
end = int(raw_input("End at: "))
count = int(raw_input("Count by: "))

for i in range(start,end+1,count) : # end + 1 because range considers the end term excluded.
        print i,

2- First code
I put prints for you to understand what happens

s = raw_input("Enter a string: ")
print "len(s)=", len(s)
rev = ""
for i in range(len(s)):
    print "i=", i, "-i-1=", -i-1
#i only want to modify the "s[ ]" part, don't want to change any other part of the code
    rev = rev + s[-i-1] # counting negative way takes the string from the end (s[-1] = last character)
print "The reverse is: " + rev

second code

s = raw_input("Enter a string: ")
rev = ""
#for this code, I only want to modify the "range( )" part of the code, i don't want to change any other part of the code
for i in range(len(s)-1, -1, -1): # range(start, end, count) start included, end excluded, count negative. this will go backward from the end of the string
    rev = rev + s[i]
print "The reverse is: " + rev
jice 53 Posting Whiz in Training

Sorry, I typed the wrong key... So...
Simply think that, when you assign a variable to another (say b=a), it is a reference assignment. If you change PART of b, you'll change a too. If you reassign b, just think it becomes another variable and does not reference a anymore so a and b will be different.

jice 53 Posting Whiz in Training

I typed the wrong key...
So... Simply think that, when you assign a variable to another, it is a reference assignment. If you change PART of b, you'll change a too. But, if you reassign b, just think b becomes another variable and does not reference a anymore.

jice 53 Posting Whiz in Training

I think he means everything but basic datatypes like int, floats and strings. However, you can do as if it was always true.

This is what i meant.
Try this and think of what it means :

a=13
b=a
b=14
print a
a=[1,2,3]
b=a
b[1]=4
print a
a=[1,2,3]
b=a
b=[4,5,6]
print a

Simply think that, when you assign a variable to another, it is a reference assignment. If you ch
just think b becomes another variable and does not reference a anymore.

jice 53 Posting Whiz in Training

Look at the buildin functions in the manual... you've got some parameters.
You just have to write :

print ('Enter quiz score %d: ' % i, end='')
jice 53 Posting Whiz in Training

It points to the original variable.
This is true for all variables containing objects.
For a list, if you want to duplicate it, you have to do

mylist = [1,2,3,4]
    a = mylist[:]
    a[0] = 'hello'
    print mylist
jice 53 Posting Whiz in Training
numQuiz = input("Enter the number of quizzes:  ")
total = 0
for i in range(numQuiz):
    print ('Enter quiz score %d: ' % i) # 
    # OR
    print ('Enter quiz score ', str(i), ' : ')
    score= input()
    total = total + score
print "------------------------------------"
# Compute the average and print it.
average = total / numQuiz
print "The average is", average
jice 53 Posting Whiz in Training

You should run your program with pythonw.
This can be done in your command line or by renaming your .py file .pyw

jice 53 Posting Whiz in Training

If I knew how the 2nd line of Jiccess code I could make it work. But I forgot to mention that each POS variable is in a certain place. I won't work to only have 1 variable. I also forgot to mention that scru's code didn't work either, it said that POS1 wasn't defined.

Sorry but I don't understand what you mean.
What do you mean with "each POS variable is in a certain place" ?

If I use one variable, it contains the tenth values.
Instead of using POS1, you'll use pos[0], POS5 will become pos[4]...

jice 53 Posting Whiz in Training

Why do you want to have vars named POSn.
I wouldn't do that...
Very complicated. It's far easier to have one list variable where you assign pos[n]

pos=['  ' for i in range(10)] # defines a list inited with ['  ', '  ',... ten times]
pos[POS-1]='->'
jice 53 Posting Whiz in Training

Sorry, I answered too fast :

zipFile.write(filedir+'/'+pathname, zipFile, compress_type=None)

zip is not defined in your program, so it refers to the builtdin function which has nothing to do with zip archives...
The object you want to write in is the onr you defined here :

zipFile = zipfile.ZipFile(picSetup[0]+'/'+zipName, 'w')
jice 53 Posting Whiz in Training

Maybe you're right... I didn't look at that very much but you have some

while True:
    ...
    while True:
        ...

That i don't like very much... But in this case, i maybe wrong.
Anyway, vegaseat seems to know about threading and I don't so you'd better listen to him.

jice 53 Posting Whiz in Training

I don't have time to test extensively your code but i'd begin by looking at loops.
I've seen a couple of while True...
How long do you stay in these loops ?
You should test and locate precisely where your program lose time.