Re: [Tutor] how to clear contents of a file

2010-02-09 Thread Christian Witts
sudhir prasad wrote: hi, how to clear contents of a file with out actually deleting it, basically wat im trying to do is copy a source file into a common file ,run the common file,after that i need to copy another source file into the common file,i ant to clear the contents of the common f

[Tutor] how to clear contents of a file

2010-02-09 Thread sudhir prasad
hi, how to clear contents of a file with out actually deleting it, basically wat im trying to do is copy a source file into a common file ,run the common file,after that i need to copy another source file into the common file,i ant to clear the contents of the common file before copying content

Re: [Tutor] NameError: global name 'celsius' is not defined (actually, solved)

2010-02-09 Thread David
Hello Wesley, thanks for your reply. I was surprised about the limited information too. Sadly (?), I can't reproduce the error any more... David On 10/02/10 11:13, wesley chun wrote: I just wrote this message, but after restarting ipython all worked fine. How is it to be explained that I f

Re: [Tutor] NameError: global name 'celsius' is not defined (actually, solved)

2010-02-09 Thread wesley chun
> I just wrote this message, but after restarting ipython all worked fine. > How is it to be explained that I first had a namespace error which, after a > restart (and not merely a new "run Sande_celsius-main.py"), went away? I > mean, surely the namespace should not be impacted by ipython at all!?

[Tutor] NameError: global name 'celsius' is not defined (actually, solved)

2010-02-09 Thread David
Hi guys, I just wrote this message, but after restarting ipython all worked fine. How is it to be explained that I first had a namespace error which, after a restart (and not merely a new "run Sande_celsius-main.py"), went away? I mean, surely the namespace should not be impacted by ipython at

[Tutor] Exiting a Tkinter Program-- An Anomaly or two

2010-02-09 Thread Wayne Watson
I'm looking a 1800+ line someone else wrote. It uses one large dialog for menus, and has a large area for images. A few menus open small dialogs, for example, to enter a file name. The File menu has an exit choice. The only other exit is the x in the upper right corner of the large dialog. I'm

Re: [Tutor] apache2.2 - django deployment

2010-02-09 Thread Glen Zangirolami
Joson, Everything looks good but I think the *module name is incorrect.* Change: LoadModule *python_module *modules/mod_wsgi.so To: LoadModule *wsgi_module *modules/mod_wsgi.so Glen On Tue, Feb 9, 2010 at 2:27 PM, Joson wrote: > Hi all, > I wanna deploy a django program on apache2.2. So I do

Re: [Tutor] apache2.2 - django deployment

2010-02-09 Thread Glen Zangirolami
Joson, Everything looks good but I think the *module name is incorrect.* Change: LoadModule *python_module *modules/mod_wsgi.so To: LoadModule *wsgi_module *modules/mod_wsgi.so Glen On Tue, Feb 9, 2010 at 2:27 PM, Joson wrote: > Hi all, > I wanna deploy a django program on apache2.2. So I do

[Tutor] apache2.2 - django deployment

2010-02-09 Thread Joson
Hi all, I wanna deploy a django program on apache2.2. So I downloaded " mod_wsgi-win32-ap22py26-3.0.so" and copied it into apache2.2/modules/, renamed "mod_wsgi.so". in httpd.conf I appended sentence: LoadModule python_module modules/mod_wsgi.so Then It failed to start the server: httpd.exe: Syn

Re: [Tutor] Closing a matplotlib window after show()

2010-02-09 Thread Wayne Watson
Form me the solution is getting into interactive mode, which I had never heard of until this morning. On 2/9/2010 9:04 AM, Wayne Watson wrote: Well, you are correct. Finally, my latest post to the MPL list caught the eye of John Hunter. I think he wrote MPL. The way out is interactive use. One

[Tutor] Embarrassed...

2010-02-09 Thread Ken G.
I am a little embarrassed. I just happen to found a program I wrote in December that create random numbers into a file, copy the numbers into a list, print the numbers unsorted and sorted from the list without printing '\n'. Nevertheless, I do thanks you all for trying to help me out. Ken

Re: [Tutor] rstrip in list? (SOLVED)

2010-02-09 Thread Ken G.
There was so many different solutions presented here to me. Thanks to all. By adding '.strip('\n') to the last two lines below, it came out: Sorted List ['102', '231', '463', '487', '555', '961'] for line in file.readlines(): print line.strip('\n'), mylist.append(line.strip('\n')) Fu

Re: [Tutor] Closing a matplotlib window after show()

2010-02-09 Thread Wayne Watson
Well, you are correct. Finally, my latest post to the MPL list caught the eye of John Hunter. I think he wrote MPL. The way out is interactive use. One problem I've had with Python packages they "seem" to based on some other product, which one is supposed to know. I sight Tkinter and now MPL

Re: [Tutor] rstrip in list?

2010-02-09 Thread Kent Johnson
On Tue, Feb 9, 2010 at 11:09 AM, Ken G. wrote: > > Kent Johnson wrote: > > On Tue, Feb 9, 2010 at 10:28 AM, Ken G. wrote: > > > I printed out some random numbers to a datafile and use 'print mylist' and > they came out like this: > > ['102\n', '231\n', '463\n', '487\n', '555\n', '961\n'] > > > Ho

Re: [Tutor] rstrip in list?

2010-02-09 Thread Robert Berman
-Original Message- From: tutor-bounces+bermanrl=cfl.rr@python.org [mailto:tutor-bounces+bermanrl=cfl.rr@python.org] On Behalf Of Ken G. Sent: Tuesday, February 09, 2010 10:29 AM To: tutor@python.org Subject: [Tutor] rstrip in list? I printed out some random numbers to a list and

Re: [Tutor] rstrip in list?

2010-02-09 Thread bob gailer
Ken G. wrote: I printed out some random numbers to a list and use 'print mylist' and they came out like this: ['102\n', '231\n', '463\n', '487\n', '555\n', '961\n'] I was using 'print mylist.rstrip()' to strip off the '\n' but kept getting an error of : AttributeError: 'list' object has no at

Re: [Tutor] rstrip in list?

2010-02-09 Thread Ken G.
Kent Johnson wrote: On Tue, Feb 9, 2010 at 10:28 AM, Ken G. wrote: I printed out some random numbers to a datafile and use 'print mylist' and they came out like this: ['102\n', '231\n', '463\n', '487\n', '555\n', '961\n'] How are you generating this list? You should be able to creat

Re: [Tutor] rstrip in list?

2010-02-09 Thread Sander Sweers
On Tuesday 09 February 2010 16:28:43 Ken G. wrote: > ['102\n', '231\n', '463\n', '487\n', '555\n', '961\n'] > > I was using 'print mylist.rstrip()' to strip off the '\n' > > but kept getting an error of : > > AttributeError: 'list' object has no attribute 'rstrip' A string has attribute rstrip

Re: [Tutor] rstrip in list?

2010-02-09 Thread Steven D'Aprano
On Wed, 10 Feb 2010 02:28:43 am Ken G. wrote: > I printed out some random numbers to a list and use 'print mylist' > and they came out like this: > > ['102\n', '231\n', '463\n', '487\n', '555\n', '961\n'] > > I was using 'print mylist.rstrip()' to strip off the '\n' > > but kept getting an error of

Re: [Tutor] rstrip in list?

2010-02-09 Thread Kent Johnson
On Tue, Feb 9, 2010 at 10:28 AM, Ken G. wrote: > I printed out some random numbers to a list and use 'print mylist' and > they came out like this: > > ['102\n', '231\n', '463\n', '487\n', '555\n', '961\n'] How are you generating this list? You should be able to create it without the \n. That woul

Re: [Tutor] Closing a matplotlib window after show()

2010-02-09 Thread zhengqing gan
Date: Tue, 9 Feb 2010 10:54:06 +0800 > From: ailx ailx > To: tutor@python.org > Subject: [Tutor] python > Message-ID: ><5fc821071002081854k2fa92309ned9389b9f3d91...@mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > python > --

[Tutor] rstrip in list?

2010-02-09 Thread Ken G.
I printed out some random numbers to a list and use 'print mylist' and they came out like this: ['102\n', '231\n', '463\n', '487\n', '555\n', '961\n'] I was using 'print mylist.rstrip()' to strip off the '\n' but kept getting an error of : AttributeError: 'list' object has no attribute 'rstrip