[Tutor] eval and exec

2004-12-03 Thread Marilyn Davis
Hello Tutors, I'm having trouble understanding the difference between eval and exec. Can anyone explain it to me please? Marilyn Davis -- ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] gzip (fwd)

2004-12-03 Thread Liam Clarke
>target_dir = 'D:\\backup' >target = target_dir +"Zipnametoreplacestrftimeformatstring"+ '.zip' Just noticed this - target_dir("D:\\backup") + "Zipnametoreplacestrftimeformatstring"+ '.zip' = D:\\backupZipnametoreplacestrftimeformatstring.zip No wonder it doesn't work. Try target=target_dir

Re: [Tutor] backup failed - gzip

2004-12-03 Thread Liam Clarke
Hi Rankumar - That's your problem then - if os.system(zip_command) == 0: > > > print 'Successful backup to', target So, os.system() returns 0 for Win 95,98, ME. For XP, it returns whatever the exit code your programme returns . So whatever zip returns, is what os.system() returns, which m

Re: [Tutor] Python regular expression

2004-12-03 Thread Alan Gauld
Have you looked at the ConfigParser module that was mentioned earlier today? Your file fits its format exactly... But regular expressions can be used, try the intro in my tutorial, or the excellent HowTo on the Python web site... Alan G. - Original Message - From: "kumar s" <[EMAIL PRO

Re: [Tutor] Creating & Handling lots of objects

2004-12-03 Thread Alan Gauld
> Although I have never done so, I believe you can also > store/manipulate objects in a database. You can but its a lot slower than memory - but a lot more scaleale too! > Has anyone ever worked this option? Yes, lots of times. In fact most large scale projects will need to save objects to so

Re: [Tutor] Creating & Handling lots of objects

2004-12-03 Thread Alan Gauld
> I've written a class, with some methods. I then want to be able to call > the class repeatedly, to create some objects. The number of objects, and > some of their initialisation parameters need to be specified later (i.e. > at run-time). Not quite sure what you mean by the last bit but I'll com

Re: [Tutor] Python regular expression

2004-12-03 Thread Rick Muller
Well, you could *try* ;-). Okay, here's a one-pass approach: #!/usr/bin/env python import re # Regular expressions stolen from PyCookbook: # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/132326 sec = re.compile(r'^\[(.*)\]') eq = re.compile(r'^([^=]+)=(.*)') def main(fname='file.ini'

Re: [Tutor] Python regular expression

2004-12-03 Thread Max Noel
On Dec 3, 2004, at 21:34, Rick Muller wrote: The file type you mention is also called an INI file, and is used for Windows initialization scripts, among other things. There's a nice recipe on this in the Python Cookbook: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65334 This will read y

Re: [Tutor] Python regular expression

2004-12-03 Thread Rick Muller
The file type you mention is also called an INI file, and is used for Windows initialization scripts, among other things. There's a nice recipe on this in the Python Cookbook: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65334 This will read your file in as a dictionary. You can then d

[Tutor] Python regular expression

2004-12-03 Thread kumar s
Dear group, I have a file with 645,984 lines. This file is composedcompletely of bocks. For e.g. [Unit111] Name=NONE Direction=2 NumAtoms=16 NumCells=32 UnitNumber=111 UnitType=3 NumberBlocks=1 [Unit111_Block1] Name=31318_at BlockNumber=1 NumAtoms=16 NumCells=32 StartPosition=0 StopPosition=1

RE: [Tutor] Create a binary for a python game

2004-12-03 Thread Robert, Andrew
Sure is. Try cx_freeze. It can be found at http://starship.python.net/crew/atuining/cx_Freeze/index.html . I've used it with great success. Thank you, Andrew Robert Systems Architect Information Technology - OpenVMS Massachusetts Financial Services Phone: 617-954-5882 Pager: 781-764-7321 E

[Tutor] Create a binary for a python game

2004-12-03 Thread David Holland
I have created a simple python game and I would like to convert it into a binary executable that can be used to play it in Linux without needing the various libraries (pygame etc). Is this possible ? ___ Win a castle for

Re: [Tutor] Python 2.4 IDLE Windows 2000

2004-12-03 Thread Danny Yoo
On Fri, 3 Dec 2004, Mike Hansen wrote: > That rooted out the problem. A while ago, I changed the colors to kind > of match my VIM color theme(ps_color). When I did > idlelib.PyShell.main(), IDLE came up with my custom color theme. > However, there was a bunch of warnings about my theme. From IDL

Re: [Tutor] Python 2.4 IDLE Windows 2000

2004-12-03 Thread Mike Hansen
That rooted out the problem. A while ago, I changed the colors to kind of match my VIM color theme(ps_color). When I did idlelib.PyShell.main(), IDLE came up with my custom color theme. However, there was a bunch of warnings about my theme. From IDLE, I deleted the theme. Now IDLE will launch n

RE: [Tutor] Creating & Handling lots of objects

2004-12-03 Thread Robert, Andrew
Although I have never done so, I believe you can also store/manipulate objects in a database. Has anyone ever worked this option? Thank you, Andrew Robert Systems Architect Information Technology - OpenVMS Massachusetts Financial Services Phone: 617-954-5882 Pager: 781-764-7321 E-mail: [EMAI

Re: [Tutor] Creating & Handling lots of objects

2004-12-03 Thread Kent Johnson
If you want to be able to access the objects by name, you can put them in a dict. For example, MyObjects={} l=["a","b","c"] for i in l: MyObjects[i] = MyClass(i) Then you can refer to MyObjects["a"] If all the operations on the objects are done to all objects in a batch, putting them in a

[Tutor] Creating & Handling lots of objects

2004-12-03 Thread Matt Williams
Dear Tutor-list, I'm sorry for this appallingly dumb question, but I'm having a little problem with objects. I've written a class, with some methods. I then want to be able to call the class repeatedly, to create some objects. The number of objects, and some of their initialisation parameters nee

Re: [Tutor] gzip (fwd)

2004-12-03 Thread Ramkumar Parimal Alagan
I have only 2 word documents in both the directories, i tried removing '-qr' too, but no change, no zip files formed. i'm using windows XP. On Thu, 2 Dec 2004 23:54:11 -0800 (PST), Danny Yoo <[EMAIL PROTECTED]> wrote: > Hi Ramkumar, > > I'm forwarding your message to Python-tutor; in your repli

Re: [Tutor] Python 2.4 IDLE Windows 2000

2004-12-03 Thread Danny Yoo
> >Yowza; that's some bug. Danny, do you happen to know the bug number? > >I can't find it on sourceforge. > > It's been like that since 2.3 as far as I know. It generates a > connection to localhost to run code in a separate environment. Hi Mike, I wish I knew what the problem was in better d

Re: [Tutor] unittest.makeSuite question

2004-12-03 Thread Danny Yoo
On Thu, 2 Dec 2004, Kent Johnson wrote: > makeSuite() creates a TestSuite object that consolidates all the test > methods of the class named by the first argument. Test methods are > identified by having names starting with the second argument. [text cut] The unit testing framework is closely

Re: [Tutor] Help

2004-12-03 Thread Danny Yoo
On Thu, 2 Dec 2004, Daniel wrote: > I need to know how to run another module through one Hi Daniel, Have you had a chance to look at one of the tutorials on: http://www.python.org/moin/BeginnersGuide_2fNonProgrammers I'm guessing that youe trying to use modules; most of the tutorials sh

Re: [Tutor] Strange Appending

2004-12-03 Thread Anna Ravenscroft
mdcooper wrote: Hello, I am trying to append a list to another list, but everytime I do, the new parent list has a new child list, but all the other lists have become the same as the new child list. Code: self._f.write(str(self.residue.atoms[int(t[0])-1].element) + ' ') for m in t:

Re: [Tutor] Help

2004-12-03 Thread Alan Gauld
> I need to know how to run another module through one what is the command do > I have to include a path name and if there is any special way I have to save > the file See my tutor for more info on modules and functions. The short answer is that if you create a module (ie a python file) and put

Re: [Tutor] comapring lists

2004-12-03 Thread Danny Yoo
On Thu, 2 Dec 2004, Jacob S. wrote: > If you or anybody else is interested, I've written a script for codes like > kids in junior high use to write notes to each other with... Hi Jacob, Cool! Do you mind if I make some comments on the code? If you do mind... um... skip this message. *grin*

Re: [Tutor] new function and a 3 line program not working

2004-12-03 Thread Alan Gauld
> I thought that the '.py ' in this import statement would make the > interpreter think that newline was a package and therefore try to recognize > py as a module in the newline package. > > from newline.py import newline Quite right it should have been from newline import mnewline! oops, sorry