shadwickman 159 Posting Pro in Training

Python doesn't need to explicity declare variables in the same way languages like C/C++, Java, etc. do. By writing for comment in inComment: you are creating a new variable called 'comment' that is set to the value of the current index of 'inComment' as it iterates through the indices for it. The thing is, with lists and tuples in Python, they don't need to be declared as only having one datatype; a list in Python can contain a string on one index, then a number, then a class instance, another list, etc. The contents of a list or tuple are fully flexible in that they can be completely of mixed data types. That being said, that means that 'comment' for the for loop will be a copy of each index, including whatever datatype that index may happen to be. Sorry for the mildly confusing explanation!

Also, the %d is an example of string formatting, the same as they have in C/C++ (is it in Java too?). Regardless, Python does not cast types for you automatically, meaning that print "comment found at line " + i will not work because you are joining a string with an integer. You could use print "comment found at line " + str(i) which converts 'i' to a string, which you can append to the rest of that line because its also a string. The %d is just the way for formatting a number via string formatting similar to printf in C. Here's a …

shadwickman 159 Posting Pro in Training

Sneekula's correct. You're storing each item in the inComments like so: (lineNumber, lineText) . So you just need to access the correct index of the tuple, the same way you would access an item in a list (or Array in Java); just use the square brackets to get the value from the list's item.

# assume inComments was built using your above code...
item = inComments[0]
# item is now a tuple of (lineNumber, lineText)

text = item[1]
# text is now a string of the second index of item

lineNumber, text = item
# demonstrates tuple or list unpacking, where it will assign the
# first value of item to the lineNumber variable, the second index
# to the text variable, and so on; it's a magical unwrapper of lists.
shadwickman 159 Posting Pro in Training

Python is a good choice for easy-going desktop application development. Of course, you're going to want to get adjusted to and familiarized with classes, methods/functions, etc. before starting on GUI projects.

And for GUIs, I'd still really suggest wxPython over Tkinter. I personally can't stand the non-native look of Tk's widgets, whereas wxPython's elements use the native operating system's look.

shadwickman 159 Posting Pro in Training

If you don't mind as much about memory usage, you could use

if number in range(10, 24):  # careful!
# This gives a range of 10 - 23.
# The end index (24) isn't included in it.

if number in xrange(10, 24):
# The xrange doesn't load the range list into memory all at once,
# but iterates over it one value at a time.
# This can save you a lot of memory for intensive/large-scale things.
# Again, the end index isn't included in the range.
shadwickman 159 Posting Pro in Training

No offense, but gross code you have there. You have an unbelievable amount that's just copy-pasted. I mean, all the questions are running pretty much the exact same code except for the Q it prints and the answer that's correct. This is what a function would be VERY useful for. Set it up so that you have a function that performs the question code, and just have it accept a string as the question, and a string of the correct letter. Roughly laid out as so:

# obviously this isn't valid Python code, just a template
def doQuestion(question, answer):
    print question
    get input
    if input is answer:
        do correct stuff
    else
        wrong stuff

# just make calls to that ONE segment of code with different arguments:
doQuestion('How old is the Internet?\nA. 5 years ...ETC', 'A')

Also, if I typed 'c' (lowercase) as an answer for a question whose answer is C, your program will tell me I'm wrong. It's comparing the user answer to only the uppcase letter. Just convert the user's answer to uppercase first by calling the upper() method on the string: if userAnswer.upper() == 'A' .

shadwickman 159 Posting Pro in Training

The armRight variable is declared and assigned to True before it is called for anything.

I'm quite sleepy, so excuse me if I'm way off here, but is armRight declared within the global scope of the script? If so, then you need to state global armRight within your function so that when you modify armRight within the function, it does in fact change the global armRight.

And when you get into passing within Python, I find it tends to get a lot more complicated than the straight-forward ways of passing in C++. It's kind of a hybrid I guess, but you do get used to the way if works and if you use Python long enough you structure your code work quite seamlessly with this part of the language.

This can sum it up fairly well though:
"If using objects' methods within a called function, a variable is considered “passed by reference” – it is modified out of the function’s scope. If using assignment on a mutable object, it is created a-new within the function, and the global value isn’t modified."

You can take a peek at a short but to-the-point snippet about Python's passing of arguments here.

shadwickman 159 Posting Pro in Training

Instead of using a global variable for p, you could just pass that to the function as an optional parameter for the recursion you're doing. And you may want to rename the function. I think that loop is not a great description of what it does; something like sumOfDigits is better.

Other than that, you can't actually modify p within the loop function until you define p as the global WITHIN the loop function, like:

p = 0
def loop():
    global p
    # now you can modify p in this function's scope

Also, your code will always print 0. You never actually make a call to the loop function at all! You just define it.

shadwickman 159 Posting Pro in Training

Bumsfeld is putting you on the right track. I'll say not to convert the raw_input to an integer like you're doing now, so that you can cycle through each character in it as a string. Then just make sure to convert to integers at the right times (i.e. when adding them).

shadwickman 159 Posting Pro in Training

Flash can take command-line arguments. So you can do os.system("flash.exe myFileToOpen.fla") . That'll open Flash and have it open the document "myFileToOpen.fla".

If the FLA is in a different directory however, you'll need to give the path in front of the filename in the command line argument. It can be relative or absolute. And if it contains spaces, you'll need to wrap it in quotes.

# absolute path and with quotes because of spaces
os.system("flash.exe 'C:\the\directory\to my file\here.fla'")
# or for relative, using just the .. syntax
os.system("flash.exe ../doc.fla")
shadwickman 159 Posting Pro in Training

Oh sorry! I didn't see your previous post metioning that :D Does anyone know if this has to do with Python 3.x? Changing the value of sys.sydout always worked for me...

shadwickman 159 Posting Pro in Training

Well I can see that the line you have redirecting the standard output (stdout) is commented out. So it won't be changing the output to that window you wanted. Or is there something I'm missing...? :P

shadwickman 159 Posting Pro in Training

The rent here in BC can be bad depending on the city too. Where I live, a one bedroom apartment with a tiny kitchen and living room/den can easily be $800/month without utilities and such. And the houses.... sheesh. The one next to us is trying to sell for 2.4 million dollars Canadian. And don't get me wrong, this isn't the top-class neighbor hood at all - the average neighborhood houses can also quite easily read a $1.7 mil. asking price (and the lots are usually tiny and crammed).

shadwickman 159 Posting Pro in Training

I don't use Tkinter as I personally hate it :P But I'm going to assume that the Text control has a write function of some kind, just like the wxPython TextCtrls. If that's the case, then you redirect the standard output stream so that it uses your Text control as the object it writes to:

import sys

# your code
outputWindow = Text(root)
outputWindow.config(relief=SUNKEN, bg='beige', width=51, height=17)
outputWindow.place(x=350, y=130)

# redirect stdout
sys.stdout = outputWindow

# and if you want to reset the stdout
# sys.stdout = sys.__stdout__

This is the sort of method I always use for wxPython GUIs. Note that this is a flexible thing though - files are objects with a write command, so they can be used to redirect output too, like if you wanted all the output logged to a file:

import sys

fh = open('log.file', 'w')
sys.stdout = fh
# program here...
fh.close()
sys.stdout = sys.__stdout__

Hope that helps :)

shadwickman 159 Posting Pro in Training

I was reacting to this:

"That is why i respect a blonde cute female c++ developer too much.
She could have taken advantage of her beauty instead of coding all her life..
She just likes to produce something with her brain, she likes contemplating and observing."

Nav33n is correct. Say hello to Serkan Sendur... if you search around for his posts you'll probably find most non-programming related threads seem to have been polluted with some (at times) disturbing material about a certain other member on this site :P
Welcome to DaniWeb hahaha :)

nav33n commented: :D heh.. +11
shadwickman 159 Posting Pro in Training

did you try dos2unix on the file first?

Oh damn, good point. I forgot about the new line thing being different on UNIX from Windows... UNIX is just \n and Windows is \r\n
I think?....

shadwickman 159 Posting Pro in Training

Yeah, the "\x##" is the format for encoding non-ansi (is that correct?...) characters. As far as I can tell, these are useless characters anyway, because if you pick through the segment: '\x00A\x00D\x00A\x00M\x00S\x00 \x00C\x00O\x00U\x00N\x00T\x00Y\x00' You can see that there are the regular letters "ADAMS COUNTY" in it. So are all these null characters useless? If so you can just remove them from every index in your script so that you'd only get those regular letters left...

EDIT:
Here's a way to remove those control characters and keep each value in the list:

# in that for loop of the lines...
s = ''.join(out)
final = []
for segment in s.split('\x00\x00'):
    temp = ''
    for char in segment:
        if ord(char) > 31:
            temp += char
    final.append(temp)

# or, for ugly but compressed code (not really recommended though...):
s = ''.join(out)
final = []
for segment in s.split('\x00\x00'):
    final.append(''.join(filter(lambda x: ord(x) > 31, [char for char in segment])))

s is the joined string of the out variable you had in your loop. I discovered that each index was separated by a \x00\x00, so I split the string at that. Then, within each of the resulting segments, I weeded out any characters whose ASCII value was less than 32 (the null/control characters). Then it appends those resulting characters to the new final list.
This is messy solution, but it left me with the output: ['001', 'ADAMS COUNTY', '99344', '46.824922', '-119.173798', 'COM', '1320'] for one of the lines. There's most likely …

shadwickman 159 Posting Pro in Training

I think over-population and limited resources make Indian students work twice as hard as anybody else.

Very true, which is sad because their population expansion was so rapid that their infrastructure and social services are very lacking for such a large amount of people.

shadwickman 159 Posting Pro in Training

Why is a good-looking coder better than not-so-good-looking/ugly coder?

Since when did anyone mention beauty or looks in this thread?...

shadwickman 159 Posting Pro in Training

but they have something in common...

Possibly some deeply-rooted Celtic hatred of the Saxons :P

And moving out isn't just that easy. I work two jobs but still live at home...

shadwickman 159 Posting Pro in Training

Annoys me. Ive learnt through working with such people on projects that a significant percentage dont work well in teams, because thier education system places a very high demand on being *the* number one through your own hard work. Gets a bit annoying when the one bloke ends up rewriting all your code on his own...

Fair enough. I haven't had those experiences that you've had. Although, I imagine some communication and coordination would also be difficult if their developers' English skills are anything like their telemarketers'...

shadwickman 159 Posting Pro in Training

You were on the right track. Find the 'del' part, then include backwards until you encounter an underscore; this allows for if the number was single, double, triple, quadruple, etc digits long.

filename = '/grups.google.com/grup/cmp.lng.pythn/browse_thread/thread/8_ee63e_17del_0c12d'
end = filename.find('del')
# reverse-find the first underscore in the filename
# from the 0-index to the end we just calculated.
# we add one because we want our start to be one
# past the underscore.
start = filename.rfind('_', filename[:end]) + 1
number = filename[start:end]
shadwickman 159 Posting Pro in Training

Well now... I think I'll just drop this and slowly back away, avoiding all eye-contact in the process...

shadwickman 159 Posting Pro in Training

That is why i respect a blonde cute female c++ developer too much. She could have taken advantage of her beauty instead of ... <snip>

Let's please not let this thread steer in the creepy direction too. That whole post was completely unnecessary and I really didn't need to read more of that drivel.

That being said, I'm not surprised that the whole development team is Indian; they have a MASSIVE population. And hey, there's nothing wrong with so many of them taking these tech jobs. Good for them for showing up any citizens in the country that the company is based out of.

shadwickman 159 Posting Pro in Training

re.split breaks the string in the specified pattern, removing the parts which caused the split. There is a much simpler solution to this problem though. Just iterate the string by splitting it at each space and compare each word to a list of words you're watching for. You don't need regular expressions for this problem:

def myFunc(s):
    # break the string into a list (at each space)
    words = s.split(' ')
    # put the words we are watching for into a list
    watched = ['this', 'a']

    # loop our words and check each one
    # and add the result to our result list
    result = []
    for w in words:
        # if the word is in the watched list
        # add the carets to each side
        if w in watched:
            w = '<' + w + '>'
        # add the word to the result list
        result.append(w)

    # join our result into a string with spaces in between
    result = ' '.join(result)
    return result

My result:

>>> s = 'Hello this is a test'
>>> myFunc(s)
'Hello <this> is <a> test'

A much simpler and cleaner solution, I think :P

shadwickman 159 Posting Pro in Training

From the py2exe site:
"py2exe does not currently (as of 0.6.5) work out of the box if some of your program's dependencies are in .egg form. "

So, here's some py2exe documentation about including .egg files in the .exe. I hope this will help you out :)

shadwickman 159 Posting Pro in Training

Open the .egg in Notepad and see what sort of data in contains... I've personally never used mechanize, but then again I've never encountered a module that ran with only an egg file. It could be a common thing that I just have had no experience with though :P

shadwickman 159 Posting Pro in Training

Is there a file in the C:\Python25\Lib\site-packages folder named mechanize.pth or a folder named mechanize in that directory? There should be, and the data in mechanize.pth should simply say "mechanize" (without the quotes).

shadwickman 159 Posting Pro in Training

I'd go with using floats because I'm sure you want to allow for using decimal numbers in your program. And as I said before, math in Python = math in wxPython. All that wxPython is, is a wrapper for the wxWidgets GUI toolkit. It doesn't change Python's language engineering or anything...

So you can make something a float the same way you would in Python: float(variable) . So if you had a string like "11.45" and you called float() on it, you'd get back 11.45 as a number (float), rather than the string. Now you can do calculations with it. You'll want error-catching in your code though so that something like "asd2-)_d2" will get rejected by your program and it will ask for input again until it gets a valid number (I mentioned the str classes' isdigit() function).

shadwickman 159 Posting Pro in Training

First, you should change the line where you bind the button to: button.Bind(wx.EVT_BUTTON, self.onClick) or else give the button an id (it's the arg passed second in the button's constructor) and then you can use self.Bind(wx.EVT_BUTTON, self.onClick, id=BTN_ID) . The way you're currently doing it, any button's press will call the onClick function, not just a press on your specific button.

Math is the same in wxPython as Python. The one difference is that you'll be getting input via widgets (not raw_input) and you'll be showing the answer differently (through a widget instead of print).

That being said, when you use GetValue() on a wx.TextCtrl, it returns a string (same deal as raw_input). So you'll need to convert it to an int or float first before you can do calculations. I'd also suggest adding error checking in this part so that it re-asks for a number if bad input was given (i.e. letters, punctuation, etc). The str class in Python has a very handy function "isdigit()" that you may try to use for this.

Once you've converted this to an int or float, then you just need to perform the simple PI * radius^2 calculation. The math module contains a PI constant you can use: from math import pi .

As for output, you have tons of options. Here I'll just show a wx.MessageDialog way of alerting the user to the answer:

# parent, message, title, style (Ok btn and 'information' icon)
dlg = wx.MessageDialog(self, …
shadwickman 159 Posting Pro in Training

I'd put the window updating segment in a function and call that via a thread as well. Try how that works out.

P.S. As long as your style works for you. I personally can't stand it as whitespace is good, but too much is difficult. It just makes it hard to see some of the OOP-based concepts with the periods being so spaced out.

shadwickman 159 Posting Pro in Training

You'll need to use threading to handle this. One thread calls the function which does the subprocess, and the other calls a function which updates the GUI. Something along the lines of:

# untested!
import thread
from time import sleep

def myFunc():
    while True:
        print 'Hello world!'
        sleep(1)
def func2():
    while True:
       print '#2!'
       sleep(0.5)

thread.start_new_thread(myFunc, ())
thread.start_new_thread(func2, ())

It's started running the myFunc function's endless loop and func2's stuff while it can continue on with other things in the script. Check this for more info:

http://docs.python.org/library/thread.html

Also, please don't use such bad writing style in your code. Only put spaces between non-unary operators. Or, at least don't put spaces between the periods denoting namespaces (like "time . sleep(0.25)") and the colons in your conditional statements. You can check here for a style guide for Python.

shadwickman 159 Posting Pro in Training

if my best friends dont get featured i am going to organize them to leave for a better c# forum where their skills are appreciated.

I'm not trying to start slinging shit here, but is this a mutual agreement or are you just putting words into your friends' mouths? Hmm... by the way this isn't a union thing or nothing. Please feel free to leave if you are fed up helping people.

shadwickman 159 Posting Pro in Training

Just read the file as-is and then write the output with the lines that aren't blank. Here's an example:

# Read lines as a list
fh = open("myfile", "r")
lines = fh.readlines()
fh.close()

# Weed out blank lines with filter
lines = filter(lambda x: not x.isspace(), lines)

# Write
fh = open("output", "w")
fh.write("".join(lines))
# should also work instead of joining the list:
# fh.writelines(lines)
fh.close()

Also, if you don't understand my lambda expression there, here's a longer route instead of using filter :

fh = open("myfile", "r")
lines = fh.readlines()
fh.close()

keep = []
for line in lines:
    if not line.isspace():
        keep.append(line)

fh = open("output", "w")
fh.write("".join(keep))
# should also work instead of joining the list:
# fh.writelines(keep)
fh.close()

All this is untested as I'm at work! But this should give you an idea of how to do it.
Hope that helps!

shadwickman 159 Posting Pro in Training

You need to use the 'self' keyword. So inside the function variable, you'd say self.f = 5 . Then when you call printf, you'd say print(self.f) .

By not making the variable a property of the class by using 'self', you're just making it in the local scope of the function. And, when you call a class' functions from within itself, you also need to attach 'self' in front. Like if within a function on class W, you wanted to make a call to its printf function, you'd use self.printf() .

Here's is the documentation about scopes and name spaces regarding classes in Python:
http://docs.python.org/tutorial/classes.html#python-scopes-and-name-spaces.

Hope that helped!

shadwickman 159 Posting Pro in Training

I'm not entirely sure... Just have a look through the Python documentation! :P

shadwickman 159 Posting Pro in Training

Well if you're using Python 2.x there's the exec expression. I don't know if it still exists in Python 3.0, and I wouldn't normally use it, but it's all I can think of in this case. All you have to do is provide a string that's valid Python and it'll get executed. Like this:

code = "print 'Hello World!'"
exec code

You just need to be careful of quotes and properly escaping them inside the string that will be executed.
Hope that helps!

shadwickman 159 Posting Pro in Training

I personally think (as a side note), that he should:

a) Use a relative path so that he can keep the project in one folder and use a hierarchy of folders within that. This allows him to move the project's folder but keep all the paths in the script valid because they're relative.
b) Use single, forward slashes in his path as that's accepted on Windows and Linux. So "C:/python26/stuff/bg.jpg" works even better.

Just my two cents :P

shadwickman 159 Posting Pro in Training

I forgot to mention that in solution #2, you assign temp_list2 to the same address of memory as list2, but then that's undone as you create a new list (and new address in memory for it) consisting of four ones. Therefore, temp_list2 no longer refers to the same data as list2.

If you want to copy the list over without making the new name reference the same data, how about

list1 = ['a', 'b', 'c', 'd']
list2 = [x for x in list1]

That'll copy all the indices of list1 into a new address for list2, and thus, they are independent of each other.

shadwickman 159 Posting Pro in Training

Here's an example of how to get the current date and time (as a string) using the datetime module.

import datetime
timestamp = str(datetime.datetime.now())
"""result ->
'2009-07-08 01:16:25.968000'
"""

Hope that helps!

shadwickman 159 Posting Pro in Training

Because your temporary list is the same thing as your other list. You said temp_list1 = list1 . This means that the value for temp_list1 will be the same address in memory as the value for list1, i.e. they reference the same thing. Modifying one modifies the other because they are just 2 different names for the same data.

shadwickman 159 Posting Pro in Training

Ah, good point, I hadn't thought of that. This illustrates what woooee means:

>>> a = b = []
>>> a.append('hi')
>>> a.append('world!')
>>> a
['hi', 'world!']
>>> b.remove('hi')
>>> b
['world!']
>>> a
['world!']
>>> id(a) == id(b)  # same address in memory
True

They both refer to the same list because of the way they were declared ( a = b = [] ), so both names are actually for only one list.

shadwickman 159 Posting Pro in Training

Like I showed in my previous post, use a boolean to track it. It's initially False, but when it encounters a line you want to remove, it becomes True. While it's True, it will disregard the lines it encounters until it finds one starting with ">". It will be set to False when it finds that again, but as it continues, any lines that have that "rs" will set it to True again, etc.

It basically starts skipping lines after a line it finds with "rs" until it finds a line starting with ">", and then it check that one to see if it's good. If it is, it stops ignoring lines, but if it's a bad line, it'll keep skipping, etc.

shadwickman 159 Posting Pro in Training

Also, please put your code in [code]

[/code] tags next time so that the indentation is kept, as it's a crucial part of Python.

Other than that, I'm still confused what you are having a problem with. Maybe the removing of the number from the whole square has to do with a different bit of your code - say if you're calling this eliminate function in a loop somewhere else which is causing the error.
Please just try to rephrase your question to be a little bit clearer, thanks.

shadwickman 159 Posting Pro in Training

So have a variable that, when set, it deletes each line it encounters until it finds one starting with a >
Then just have this set to True or something once you find a line you want to remove, and it'll remove the lines after that don't start with > (which would the lines with the sequence). Then just set it to False once it encounters a line starting with > again.
Sorry if that wasn't too clear :P This is what I meant:

from __future__ import with_statement

with open ('dna.txt') as fil:
    f = fil.readlines()
    delete_seq = False
    for line in f:
        if line[0] == ">":
            delete_seq = False
            
        if "rs" in line:
            delete_seq = True
        elif not delete_seq:
            print line,

It will set delete_seq to True if it finds an "rs" in the line, and while delete_seq is True, it'll ignore any following lines until one of them starts with ">", which will set it back to False. If you need me to clarify, just ask. Here's my output:

>1|100159271|ENSRNOSNP145|T/A||ENSEMBL:celera|T/A
TCTTATAATTAGTCATTGTGATAACTGCTACAAACAAAGTCACAGGATCTTGTGAGAGAA
>1|101456015|ENSRNOSNP1318|G/C||ENSEMBL:celera|G/C
AACTCTTAGAAGTTAGAACCTGGGGTGGAGAGATGGCTTGGTGGTTGAGAGCATTGACTG
shadwickman 159 Posting Pro in Training

Ok, so I rewrote some stuff and commented it a bit to help you out.

room_num = raw_input("Enter your room number: ")
text_file = open("roombookings.txt", "r")
# store a list containing the lines from the file
whole_thing = text_file.readlines()

# join all the lines into a string to search
if room_num in "".join(whole_thing):
    print "Room number found here is the information:"
else:
    print "Room number not found."
    
# we keep a list of lines that we want to save
lines_to_save = []

# cycle each line in our whole_thing list
for single_line in whole_thing:
    if room_num in single_line:
        print single_line
        # add the line to the saving list
        lines_to_save.append(single_line)
    
# here we open the output file
fileObj = open("courseinfo.dat","w")
# and join our saved lines into one string to write
fileObj.write("".join(lines_to_save))
fileObj.close()

text_file.close()

The comments explain the changes I made pretty well. You had a few issues like that readline() that I explained. You were on the right track though! Remember that the file write(str) function will overwrite all the file's contents with the string passed to it, so if you were to call it during the for loop, it would overwrite everything else it had saved before. Hence saving the lines to a list to write at the end. You could also create the file before-hand and then open it again in append mode, but this works fine for your problem. I hope the comments explain the code properly. If not, just ask me to clarify!

shadwickman 159 Posting Pro in Training

First, your whole_thing variable should be text_file.read() if you want to return all the contents as a string. Or text_file.readlines() if you want to return all the contents as a list of each line. Change this and see if that fixes any problems with your code.

I don't fully understand what you mean by "search results", but I assume you mean the single_line variable if the room number is in that line. If you want to write that line to the "courseinfo.dat" file, the just stick that writing segment inside where you are currently printing the single_line. Like this:

single_line = whole_thing.split('\n')
for single_line in text_file.readlines():
   if room_num in single_line:
        fileObj = open("courseinfo.dat","w")
        fileObj.write(single_line)
        fileObj.close()

If this isn't what you meant, please rephrase your question clearly and maybe include some sort of example of what "roombookings.txt" contains, etc.

shadwickman 159 Posting Pro in Training

By putting "s = d / t" before the conditionals would only calculate speed - but what happens when you give speed and distance for example? It wouldn't calculate time. You have to put each individual case within the appropriate conditional branch like Lardmeister did.

P.S. This kind of program is much more useful for something like cosine law, sine law, quadratic formula, etc. as opposed to the simplistic s = d / t which is just a simple, one-step calculation :P

shadwickman 159 Posting Pro in Training

And I just found this:
http://www.pyinstaller.org/

It claims to make executables for Windows, Linux, and Mac. I have never used it myself though.

shadwickman 159 Posting Pro in Training

You may also want to look into unwrapping, like this example:

coords = [14, 16, 4]
x, y, z = coords
"""result -->
x = 14
y = 16
z = 4
"""
shadwickman 159 Posting Pro in Training

Well, I posted the tutorial which explains it well. Regardless, put this in a file called setup.py in the same location as your script. Put this in setup.py:

from distutils.core import setup
import py2exe

setup(console=["YOURSCRIPTNAME.py"])  # replace with your program's filename

Then, open the DOS/MS-Windows command prompt, and move to your script's location. Then use this command:

python setup.py py2exe

That should make your .exe. If you have an error, please type out what it says so I can understand what went wrong!