Re: [Tutor] creating a regularly placed fields in a line
On Wed, 25 Apr 2012, Prasad, Ramit wrote: Useful to know both though, since lots of people swear by % substitution. And % formatting is slightly faster - if you end out doing tons of formatting and you find your script isn't fast enough, it's worth taking a look there. -Wayne ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Python equivalent of "kill -0 PID"
In bash you can do this to see if a process is running: [scarolan@kurobox:~/bin]$ kill -0 24275 [scarolan@kurobox:~/bin]$ echo $? 0 Is there a python equivalent? I tried using os.kill() but did not see any way to capture the output. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Python equivalent of "kill -0 PID"
On Thu, Apr 26, 2012 at 3:24 PM, Sean Carolan wrote: > In bash you can do this to see if a process is running: > > [scarolan@kurobox:~/bin]$ kill -0 24275 > [scarolan@kurobox:~/bin]$ echo $? > 0 > > Is there a python equivalent? I tried using os.kill() but did not see > any way to capture the output. > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor I don't know the answer to your question, but I googled this article: http://www.ibm.com/developerworks/aix/library/au-python/ It talks about various sys admin things you can do with python. It might get you started -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Python equivalent of "kill -0 PID"
On 04/26/2012 02:24 PM, Sean Carolan wrote: > In bash you can do this to see if a process is running: > > [scarolan@kurobox:~/bin]$ kill -0 24275 > [scarolan@kurobox:~/bin]$ echo $? > 0 > > Is there a python equivalent? I tried using os.kill() but did not see > any way to capture the output. You might start with something like this ... # python2.x try: os.kill(24275, 0) except OSError, e: if e.errno != 3: # 3 = No such process raise # process is not running, do something else: # process is running, do something It would seem os.kill returns nothing if the signal is sent successfully, and will raise an exception if not. HTH! Marty ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] tkinter question
hi everyone, I'm usting python 3.2 on windows, and I'm doing these GUI exercises using tkinter. I've created this simple window with two widgets (a label and a button) the button is supposed to exit the root window, but the problem is it doesn't seem to, for some reason. It looks like it is "trying to", but the window persists for some reason and becomes unresponsive. I'm NOT doing this in IDLE as i know there are issues with this. so is it an issue the Windows? or What? 1. import tkinter 2. top=tkinter.Tk() 3. 4. salam = tkinter.Label(top,text='salam') 5. salam.pack() 6. 7. quit= tkinter.Button(top, text='quit', command=top.quit,bg='red',fg= 'white') 8. * * 9. quit.pack(fill=tkinter.X) 10. 11. tkinter.mainloop() ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] PIL and converting an image to and from a string value
Here is what I am trying to: the application user chooses an image file. I want to store the image data in a field in a sqlite database. My understanding from the reading I have done is that I have to convert the image data into a string , which I can then store in the database. Additionally, I need to be able to take the stored image data and convert it back to an image so I can display it in a canvas widget. I am using the python imaging library I think I have the following parts correct: image = Image.open("cover.jpg") image = image.resize((150,150),Image.ANTIALIAS) png = image.tostring("PNG") I am taking the image data from the file, resizing the image, and then using the PNG coder to force it into a PNG format image and converting it to a string. I am stuck however, in figuring out how to take the string data and converting it back to an image that I can put into the canvas widget. Either I am not finding a good explanation of how to do this or I am just not understanding what I am finding:-) Any ideas are appreciated! Thanks, Chris ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] virtualenv
I recently asked the question how can I get graphic.py to work on my edition of Python which is 2.7.2 The problem was identified by Python tutor from my error messages as: "What that error is telling you is that you have a version 8.5.9 oftcl, but whatever you're trying to run is expecting _only_ 8.5.2 Sadly, probably, the way to "fix" this is by relaxing the requirements of the thing you're trying to run. Alternatively, look at virtualenv to set up an environment your code will work with." My next question is where do I obtain an appropriate version of virtualenv? My operating system is OS Name Microsoft Windows 7 Professional Version 6.1.7600 Build 7600 . I would appreciate any help, kind regards Ivor Surveyor isurve...@vianet.net.au ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor