Re: [Tutor] Running a script in the background

2012-09-02 Thread Michael Lewis
> > > > Michael, I see you have several Windows answers, but it doesn't look as > though you found quite what you were hoping for on OSX. My suggestion > would be to take the script and run it through py2app, which will turn it > into a stand-alone application which can then be added to your list

Re: [Tutor] Running a script in the background

2012-09-01 Thread Michael Lewis
> For windows not sure but for osx just add an & after the command. > > python myscript.py & > Thanks, but I know about that. I should have been more clear. What I want to do is have the script run in the background without even seeing the terminal. Adding the & after the command will let do other

[Tutor] Running a script in the background

2012-09-01 Thread Michael Lewis
Hi everyone, I am sorry to ask this when there are a lot of resources online regarding the subject, but I've spent the past two days trying to figure this out and I don't get it. I have a script that will run forever. Since it runs forever, I don't want to see the interpreter or command line. I w

Re: [Tutor] re.search() help

2012-04-15 Thread Michael Lewis
> > Message: 6 > Date: Sun, 15 Apr 2012 08:48:10 +0100 > From: Alan Gauld > To: tutor@python.org > Subject: Re: [Tutor] re.search() help > Message-ID: > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > On 15/04/12 08:10, Michael Lewis wrote: >

[Tutor] re.search() help

2012-04-15 Thread Michael Lewis
Hi everyone, I am a bit confused on how one would ever use re.search(). It essentially tells me the location on (RAM?) if the pattern matches? What is the purpose of this? Can you give me a good example of where it would be useful? Thanks! re.search(*pattern*, *string*, *flags=0*)

Re: [Tutor] Re.findall()

2012-04-12 Thread Michael Lewis
> > mjole...@gmail.com wrote: > > Hi everyone, > > > > I am having trouble understanding re.findall(). I've read through the > > documentation and looked at at some examples online, but I still don't > have > > a clear picture. > > > > I am going through pythonchallenge.com and I am on challenge 3.

Re: [Tutor] Running scripts at login

2012-04-05 Thread Michael Lewis
> > > >>> Hi everyone, > >>> > >>> I am researching how to automatically run some of my scripts after I > log > >>> into my Windows machine. I don't want to have to manually run the > script > >>> or setup a windows task. > >> The same way you run any Windows program on startup: > >> Add the script

Re: [Tutor] Running scripts at login

2012-04-05 Thread Michael Lewis
> > > On 05/04/12 05:59, Michael Lewis wrote: > > Hi everyone, > > > > I am researching how to automatically run some of my scripts after I log > > into my Windows machine. I don't want to have to manually run the script > > or setup a windows task. >

[Tutor] Running scripts at login

2012-04-04 Thread Michael Lewis
Hi everyone, I am researching how to automatically run some of my scripts after I log into my Windows machine. I don't want to have to manually run the script or setup a windows task. I'd like to have a piece of code that I can insert into my script that will allow it to run after I login. I fou

[Tutor] Permissions Error

2012-03-26 Thread Michael Lewis
> > Message: 1 > Date: Mon, 26 Mar 2012 10:52:19 +1100 > From: Steven D'Aprano > To: tutor@python.org > Subject: Re: [Tutor] Permissions Error > Message-ID: <4f6fafb3.4060...@pearwood.info> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed >

[Tutor] Permissions Error

2012-03-25 Thread Michael Lewis
Hi everyone, If I've created a folder, why would I receive a permissions error when trying to copy the file. My source code is here: http://pastebin.com/1iX7pGDw When I check the properties/security of the file in question, the system says I have full control. Thanks. -- Michael

[Tutor] Error Handling

2012-03-25 Thread Michael Lewis
In the below block, why is the if statement e.errno != errno.EEXIST? Why can the errno be both before and after the "."? import os, errno try: os.makedirs('a/b/c') except OSError, e: if e.errno != errno.EEXIST: raise -- Michael J. Lewis mjole...@gmail.com 415.815.7257

Re: [Tutor] Error handling

2012-03-24 Thread Michael Lewis
On Sat, Mar 24, 2012 at 3:51 PM, Colton Myers wrote: > I am having a bit of trouble understanding what is going on below. What > does the "e" in "except OSError, e:" do? > Any other help you can provide regarding errno would be extremely > appreciated. I've done help() and dir() on it, but I am n

[Tutor] Error handling

2012-03-24 Thread Michael Lewis
Hi everyone, I am having a bit of trouble understanding what is going on below. What does the "e" in "except OSError, e:" do? Any other help you can provide regarding errno would be extremely appreciated. I've done help() and dir() on it, but I am not really understanding what's going on with "e.e

[Tutor] question on self

2012-03-11 Thread Michael Lewis
Why do I have to use "self.example" when calling a method inside a class? For example: def Play(self): '''find scores, reports winners''' self.scores = [] for player in range(self.players): print print 'Player', player + 1 self.score

[Tutor] Writing to a file/changing the file name

2012-02-22 Thread Michael Lewis
Hi everyone, I have a program where I open a file (recipe.txt), I read that file and write it to another file. I am doing some multiplying of numbers in between; however, my question is, when I name the file I am writing to, the file extension is changed, but the file name is not. What am I doing

[Tutor] Compiled Python File

2012-02-22 Thread Michael Lewis
First, thanks to everyone who helped me out regarding my Recognizing real numbers post. I gained a lot of knowledge over the past two days! I've noticed that after I execute some of my .py files, a Compiled Python File is automatically saved to my directory. This doesn't happen for every file that

Re: [Tutor] Recognizing real numbers

2012-02-22 Thread Michael Lewis
On Wed, Feb 22, 2012 at 2:52 PM, Dave Angel wrote: > On 02/21/2012 10:00 PM, Michael Lewis wrote: > >> Hi everyone, >> >> I have some code where I import a file to use a module. That module that I >> import takes text and a multiplier, checks for any numbers in

Re: [Tutor] Recognizing real numbers (bob gailer)

2012-02-22 Thread Michael Lewis
> Hi everyone, > > I have some code where I import a file to use a module. That module > that I import > takes text and a multiplier, checks for any numbers in that text and > will then multiply those numbers by the given multiplier. The imported > module is below. I am getting the text from a fil

[Tutor] Recognizing real numbers

2012-02-21 Thread Michael Lewis
Hi everyone, I have some code where I import a file to use a module. That module that I import takes text and a multiplier, checks for any numbers in that text and will then multiply those numbers by the given multiplier. The imported module is below. I am getting the text from a file that I have

[Tutor] '__name__' == '__main__'

2012-02-20 Thread Michael Lewis
I am back to being confused. I just tried running the module without first importing it, and it worked just fine. How do I do this properly to where the module only runs if I import it? Code: def MultiplyText(text, multiplier): '''Recieve a S & int. For digits in S, multiply by multiplier and

Re: [Tutor] __name__=='__main__'

2012-02-20 Thread Michael Lewis
Now that I am better understanding '__name__'=='__main__', I need to get advice on one last part. Since you put this in the file as an if statement, some instruction must come after. What do you suggest putting after this statement/is that piece of code ever put into action? In my example below, I'

Re: [Tutor] __name__=='__main__'

2012-02-20 Thread Michael Lewis
20/2012 6:46 PM, Michael Lewis wrote: > >> Hi everyone, >> >> I am having some trouble understanding how to use __name__== '__main__'. >> Can you please give me some insight? Also, to use this, it needs to be >> within a function? Do you typically just thro

Re: [Tutor] Tutor Digest, Vol 96, Issue 83

2012-02-20 Thread Michael Lewis
> On Mon, Feb 20, 2012 at 6:46 PM, Michael Lewis wrote: > > I at first put it outside and after all my functions but got the error > below > > That's the right place for it, you just spelled it wrong. > > > and then put it inside my last function and the progr

[Tutor] __name__=='__main__'

2012-02-20 Thread Michael Lewis
Hi everyone, I am having some trouble understanding how to use __name__== '__main__'. Can you please give me some insight? Also, to use this, it needs to be within a function? Do you typically just throw it in your very last function or create a separate function just for this? I at first put it o

[Tutor] tabbed output

2012-02-12 Thread Michael Lewis
I am having a weird issue. I have a print statement that will give me multiple outputs separated by a tab; however, sometimes there is a tab between the output and sometimes there is not. It seems sort of sporadic. My code is below and two sample outputs are below that (one that works how I expect,

[Tutor] repeat a sequence in range

2012-02-11 Thread Michael Lewis
I am trying to repeat a certain sequence in a range if a certain even occurs. Forgive me for not pasting my code; but I am not at the machine where it's saved. Basically, I want to get user input and append that input to a list only if the input is not already in the list. I want to do this x amou

Re: [Tutor] Character Buffer Object Error

2012-02-09 Thread Michael Lewis
On Thu, Feb 9, 2012 at 2:43 PM, bob gailer wrote: > Always reply-all so a copy goes to the tutor list. > > On 2/8/2012 11:04 PM, Michael Lewis wrote: > > Thanks Bob, > > Thanks for what if you did not follow my suggestions? > I partially followed your suggestions by ge

[Tutor] Character Buffer Object Error

2012-02-07 Thread Michael Lewis
I want to find all digits in a string and then increment those digits by 1 and then return the same string with the incremented digits. I've tried the following code, but I am getting the following error. How do I do this properly? def AlterInput(user_input): print user_input new_output =

Re: [Tutor] Tutor Digest, Vol 96, Issue 26

2012-02-07 Thread Michael Lewis
On Tue, Feb 7, 2012 at 10:57 AM, wrote: > Send Tutor mailing list submissions to >tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, visit >http://mail.python.org/mailman/listinfo/tutor > or, via email, send a message with subject or body 'help' to >t

[Tutor] Lists/raw_input

2012-02-06 Thread Michael Lewis
I want to prompt the user only once to enter 5 numbers. I then want to create a list out of those five numbers. How can I do that? I know how to do it if I prompt the user 5 different times, but I only want to prompt the user once. Thanks. -- Michael

[Tutor] Importing libraries

2012-02-03 Thread Michael Lewis
Why don't I have to import str or list to access their attributes like I do with the math or random or any other library? -- Michael J. Lewis mjole...@gmail.com 415.815.7257 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription

[Tutor] ASCII Conversion

2012-01-30 Thread Michael Lewis
I am trying to do a simple test but am not sure how to get around ASCII conversion of characters. I want to pass in y have the function test to see if y is an integer and print out a value if that integer satisfies the if statement. However, if I pass in a string, it's converted to ASCII and will s

Re: [Tutor] Rounding Error

2012-01-27 Thread Michael Lewis
Update I am trying to round a float to two decimals. > > Basically, I am writing a program to ask a user how many square feet they > need to paint. I then calculate how many cans of paint they need and will > also show the total purchase price. I've tried this two ways, and both ways > I am semi-s

[Tutor] Rounding Error

2012-01-27 Thread Michael Lewis
I am trying to round a float to two decimals, but I am getting the following error: Traceback (most recent call last): File "", line 1, in PaintingProject() File "C:/Python27/Homework/Labs/Lab 03_5.py", line 42, in PaintingProject print 'That will cost you $%f.' %(round(5.6523),2) Typ

[Tutor] Error Checking/Defensive Programming

2012-01-25 Thread Michael Lewis
Hi everyone, I am new to python and have a noob question. Is it generally better to use try/except/else statements or if/elif/else? Or, is there a time and place for each? For a simple example, assume I want a user to enter a number 1) try: number = float(input('enter a number: ') exc