Re: Unwanted window spawns when using Tkinter with multiprocessing.

2013-04-29 Thread Dave Angel
On 04/29/2013 09:17 PM, alternativ...@rocketmail.com wrote: I thought 'clause' was reffering to the 'if __name__ == "__main__":' thing in English, but apparently not. Well except the import and the 'globalization' of my variables, every thing is idented. No clue whom you think you're replyin

Re: repeat program

2013-04-29 Thread Ian Kelly
On Mon, Apr 29, 2013 at 6:43 PM, MRAB wrote: > By the way, there's a bug in 'choosecave': what happens if the user > enters, say, '3'? Then they lose. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Unwanted window spawns when using Tkinter with multiprocessing.

2013-04-29 Thread alternative00
I thought 'clause' was reffering to the 'if __name__ == "__main__":' thing in English, but apparently not. Well except the import and the 'globalization' of my variables, every thing is idented. -- http://mail.python.org/mailman/listinfo/python-list

Re: repeat program

2013-04-29 Thread Denis McMahon
On Mon, 29 Apr 2013 17:22:28 -0700, eschneider92 wrote: > How do I make the following program repeat twice instead of asking > whether the player wants to play again? You change something in the folowing two lines: playagain='yes' while playagain=='yes': What you change and how you change it is

Re: repeat program

2013-04-29 Thread MRAB
On 30/04/2013 01:22, eschneide...@comcast.net wrote: How do I make the following program repeat twice instead of asking whether the player wants to play again? import random import time def intro(): print('You spot 2 caves in the distance.') print ('You near 2 cave entrances..')

Re: repeat program

2013-04-29 Thread Dave Angel
On 04/29/2013 08:22 PM, eschneide...@comcast.net wrote: How do I make the following program repeat twice instead of asking whether the player wants to play again? Turn it into a function call, and call that function twice from top-level. Or, more generally, for i in range(2): doit()

repeat program

2013-04-29 Thread eschneider92
How do I make the following program repeat twice instead of asking whether the player wants to play again? import random import time def intro(): print('You spot 2 caves in the distance.') print ('You near 2 cave entrances..') time.sleep(1) print('You proceed even nearer...')

Re: How do I encode and decode this data to write to a file?

2013-04-29 Thread Terry Jan Reedy
On 4/29/2013 5:47 AM, c...@isbd.net wrote: case). Here's the traceback:- File "/usr/local/lib/python2.7/dist-packages/gallery/picture.py", line 361, > in createPictureHTML file.write("".join(html).encode('utf-8')) > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 7

Re: Unwanted window spawns when using Tkinter with multiprocessing.

2013-04-29 Thread Chris Angelico
On Tue, Apr 30, 2013 at 4:44 AM, wrote: > Yeah I did, but I globalized my variables, I've got only functions, and not > methods, and my clause seems to work so I don't know why it doesn't work. I don't know what you mean by your "clause", and I think we have a language barrier here. (Though you

Re: Mystery of module bindings!

2013-04-29 Thread Ethan Furman
On 04/29/2013 12:30 PM, Peter Rowat wrote: This must be a trivial question: I have "import numpy as np" in the python startup file. A file called mod1.py contains "def myfn..." and inside myfn there is a call to, say, "np.convolve". Interactively: python (numpy imported as np) impor

Re: Drag and drop in Windows

2013-04-29 Thread Christian Gollwitzer
Hi Robert, Am 29.04.13 12:25, schrieb Robert Flintham: I’ve found this (TkDND): http://wiki.tcl.tk/2768 > But I don’t know how to implement this in Python. The Windows binary > for it comes as a set of “.tcl” files and a single “.dll” file. > 2.direct implementation of the Tcl file [tk.eval(‘

Re: Mystery of module bindings!

2013-04-29 Thread Dave Angel
On 04/29/2013 04:03 PM, Dave Angel wrote: Please ignore my previous response, obviously I misread your question entirely. I've never used a startup file, so I misread it as "script file". Yes, you need a separate import from any module that references numpy. Don't worry about performance, s

Re: Mystery of module bindings!

2013-04-29 Thread Dave Angel
On 04/29/2013 03:30 PM, Peter Rowat wrote: This must be a trivial question: I have "import numpy as np" in the python startup file. A file called mod1.py contains "def myfn..." and inside myfn there is a call to, say, "np.convolve". Interactively: python (numpy imported as np) impor

Re: Mystery of module bindings!

2013-04-29 Thread Ned Batchelder
On 4/29/2013 3:30 PM, Peter Rowat wrote: This must be a trivial question: I have "import numpy as np" in the python startup file. A file called mod1.py contains "def myfn..." and inside myfn there is a call to, say, "np.convolve". Interactively: python (numpy imported as np) import

Re: Mystery of module bindings!

2013-04-29 Thread Steven D'Aprano
On Mon, 29 Apr 2013 12:30:29 -0700, Peter Rowat wrote: > This must be a trivial question: > > I have "import numpy as np" in the python startup file. That only runs interactively. It does not run when you execute a script. > A file called mod1.py contains "def myfn..." > and inside myfn there

Mystery of module bindings!

2013-04-29 Thread Peter Rowat
This must be a trivial question: I have "import numpy as np" in the python startup file. A file called mod1.py contains "def myfn..." and inside myfn there is a call to, say, "np.convolve". Interactively: >python (numpy imported as np) >import mod1 > >mod1.myfn(...) Error: global name "n

Re: Unwanted window spawns when using Tkinter with multiprocessing.

2013-04-29 Thread alternative00
Yeah I did, but I globalized my variables, I've got only functions, and not methods, and my clause seems to work so I don't know why it doesn't work. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can read in the BMP data correctly ,but the size is not right?

2013-04-29 Thread 88888 Dihedral
Jimmie He於 2013年4月30日星期二UTC+8上午1時20分49秒寫道: > I'm trying to read in the BMP data by the the code below,and I'm check the > data array with WINHEX,and it is correct,but which confuse me is why the size > is 0x180,but the actual picture should be 48*48 = 0x120 bytes because I use > 1-bit BMP not th

Re: Can read in the BMP data correctly ,but the size is not right?

2013-04-29 Thread MRAB
On 29/04/2013 18:20, Jimmie He wrote: I'm trying to read in the BMP data by the the code below,and I'm check the data array with WINHEX,and it is correct,but which confuse me is why the size is 0x180,but the actual picture should be 48*48 = 0x120 bytes because I use 1-bit BMP not the 24bit BMP,co

Re: Can read in the BMP data correctly ,but the size is not right?

2013-04-29 Thread Peter Otten
Jimmie He wrote: >I'm trying to read in the BMP data by the the code below,and I'm check >the data array with WINHEX,and it is correct,but which confuse me is >why the size is 0x180,but the actual picture should be 48*48 = 0x120 >bytes because I use 1-bit BMP not the 24bit BMP,coul

Re: Can read in the BMP data correctly ,but the size is not right?

2013-04-29 Thread Chris Angelico
On Tue, Apr 30, 2013 at 3:20 AM, Jimmie He wrote: > handle1.close I haven't looked at the rest of the code, but be careful of this: You aren't actually *calling* this function. That might be your problem and it might not, but try fixing it (add the parentheses, even though there's nothing

Re: Unwanted window spawns when using Tkinter with multiprocessing.

2013-04-29 Thread Chris Angelico
On Tue, Apr 30, 2013 at 3:32 AM, wrote: > It definetly helped, windows don't pop up anymore, but now it doesn't make > any sound anymore. Could it be because of a local (non-global) variable ? Did you read what I linked you to? There are rules to using multiprocessing; more of them on Windows.

Re: Unwanted window spawns when using Tkinter with multiprocessing.

2013-04-29 Thread alternative00
It definetly helped, windows don't pop up anymore, but now it doesn't make any sound anymore. Could it be because of a local (non-global) variable ? -- http://mail.python.org/mailman/listinfo/python-list

Can read in the BMP data correctly ,but the size is not right?

2013-04-29 Thread Jimmie He
I'm trying to read in the BMP data by the the code below,and I'm check the data array with WINHEX,and it is correct,but which confuse me is why the size is 0x180,but the actual picture should be 48*48 = 0x120 bytes because I use 1-bit BMP not the 24bit BMP,could any one give some hints? ---

Re: Unwanted window spawns when using Tkinter with multiprocessing.

2013-04-29 Thread MRAB
On 29/04/2013 16:31, alternativ...@rocketmail.com wrote: My full code is : #Import from tkinter import * import wave import winsound import multiprocessing #Initialisation fenetre=Tk() frame = Frame(fenetre, width=200, height=100) instance = 'Instance' #Fonctions def key(event): insta

Re: Unwanted window spawns when using Tkinter with multiprocessing.

2013-04-29 Thread alternative00
My full code is : #Import from tkinter import * import wave import winsound import multiprocessing #Initialisation fenetre=Tk() frame = Frame(fenetre, width=200, height=100) instance = 'Instance' #Fonctions def key(event): instance = 'Instance' hitkey = event.char instance =

Re: How do I encode and decode this data to write to a file?

2013-04-29 Thread Skip Montanaro
> How strange. I think it must be something to do with the gmane > interface between news and mail then. Probably. It was borked in Gmail as well... Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I encode and decode this data to write to a file?

2013-04-29 Thread cl
Robert Kern wrote: > On 2013-04-29 13:59, c...@isbd.net wrote: > > Dave Angel wrote: > >> On 04/29/2013 05:47 AM, c...@isbd.net wrote: > >> > >> A couple of generic comments: your email program made a mess of the > >> traceback by appending each source line to the location information. > >> > >

Re: How do I encode and decode this data to write to a file?

2013-04-29 Thread Robert Kern
On 2013-04-29 13:59, c...@isbd.net wrote: Dave Angel wrote: On 04/29/2013 05:47 AM, c...@isbd.net wrote: A couple of generic comments: your email program made a mess of the traceback by appending each source line to the location information. What's me email program got to do with it? :-)

Re: How do I encode and decode this data to write to a file?

2013-04-29 Thread cl
Dave Angel wrote: > On 04/29/2013 05:47 AM, c...@isbd.net wrote: > > A couple of generic comments: your email program made a mess of the > traceback by appending each source line to the location information. > What's me email program got to do with it? :-) I'm using a dedicated newsreader (

Re: How do I encode and decode this data to write to a file?

2013-04-29 Thread cl
Andrew Berg wrote: > On 2013.04.29 04:47, c...@isbd.net wrote: > > If I understand correctly the encode() is saying that it can't > > understand the data in the html because there's a character 0xc3 in it. > > I *think* this means that the é is encoded in UTF-8 already in the > > incoming data str

Re: xml.etree.ElementTree if element does not exist?

2013-04-29 Thread Neil Cerutti
On 2013-04-29, Neil Cerutti wrote: > find returns None when it doesn't find what you asked for. So you > can't check the .text attribute right away unless you want an > exception thrown. I deal with these annoyances like this: > > sepelem = > content.find(".//{http://www.huawei.com.cn/schema/comm

Re: [pyxl] Re: xlrd 0.9.2 released!

2013-04-29 Thread Neil Cerutti
On 2013-04-29, Chris Withers wrote: > There aren't any, because there are no changes. Applications > written for 0.6.x will still work without change when using > 0.9.2. The Python 3 support is greatly appreciated. I've started using the xlrd package recently, and it's made the life of a few of m

Re: xml.etree.ElementTree if element does not exist?

2013-04-29 Thread Neil Cerutti
On 2013-04-29, Ombongi Moraa Fe wrote: > > Good Afternoon, > > Among other elements values that my script finds is value for sepid > > sepid = content.find(".//{http://www.huawei.com.cn/schema/common/v2_1}sepid > ").text > > > however, if i pass xml data that DOES NOT contain sepid element, i get

Re: Shear image (numpy.ndarray)

2013-04-29 Thread Radek Machulka
Yes, I already find that scipy.ndimage.interpolation.affine_transform will solve this (but thank you Robert anyway!). Just for others (if somebody will find this thread): The 'matrix' parameter is transformation matrix for shear transformation. For more detailes see: http://en.wikipedia.org/wiki/S

Re: xml.etree.ElementTree if element does not exist?

2013-04-29 Thread Ombongi Moraa Fe
Hi Stefan, Group Thanks for the thumbs up. Worked perfectly. Saludos Ombongi Moraa Faith On 29 April 2013 14:22, Stefan Holdermans wrote: > Ombongi, > > > however, if i pass xml data that DOES NOT contain sepid element, i get > an error: > > > > Traceback (most recent call last): > > File

Re: How do I encode and decode this data to write to a file?

2013-04-29 Thread Dave Angel
On 04/29/2013 05:47 AM, c...@isbd.net wrote: A couple of generic comments: your email program made a mess of the traceback by appending each source line to the location information. Please mention your Python version & OS. Apparently you're running 2.7 on Linux or similar. I am debugging

Re: xml.etree.ElementTree if element does not exist?

2013-04-29 Thread Stefan Holdermans
Ombongi, > however, if i pass xml data that DOES NOT contain sepid element, i get an > error: > > Traceback (most recent call last): > File "/usr/local/bin/receive.py", line 21, in > sepid = > content.find(".//{http://www.huawei.com.cn/schema/common/v2_1}sepid";).text > AttributeError: '

Re: How do I encode and decode this data to write to a file?

2013-04-29 Thread Peter Otten
c...@isbd.net wrote: > I am debugging some code that creates a static HTML gallery from a > directory hierarchy full of images. It's this package:- > https://pypi.python.org/pypi/Gallery2.py/2.0 > > > It's basically working and does pretty much what I want so I'm happy to > put some effort i

Drag and drop in Windows

2013-04-29 Thread Robert Flintham
Hello all, Sorry to post such a generic question, but after searching the interwebs I'm not really any wiser about how to start with this. I'm currently on: Windows XP Python 2.7 I'm trying to create a small window in Python 2.7, that when you drop a file onto it from Windows explorer returns

RE: xml.etree.ElementTree if element does not exist?

2013-04-29 Thread Ombongi Moraa Fe
Good Afternoon, Among other elements values that my script finds is value for sepid sepid = content.find(".//{http://www.huawei.com.cn/schema/common/v2_1}sepid ").text however, if i pass xml data that DOES NOT contain sepid element, i get an error: Traceback (most recent call last): File "/u

Re: How do I encode and decode this data to write to a file?

2013-04-29 Thread Andrew Berg
On 2013.04.29 04:47, c...@isbd.net wrote: > If I understand correctly the encode() is saying that it can't > understand the data in the html because there's a character 0xc3 in it. > I *think* this means that the é is encoded in UTF-8 already in the > incoming data stream (should be as my system is

How do I encode and decode this data to write to a file?

2013-04-29 Thread cl
I am debugging some code that creates a static HTML gallery from a directory hierarchy full of images. It's this package:- https://pypi.python.org/pypi/Gallery2.py/2.0 It's basically working and does pretty much what I want so I'm happy to put some effort into it and fix things. The problem

Re: [pyxl] Re: xlrd 0.9.2 released!

2013-04-29 Thread Chris Withers
On 26/04/2013 20:37, Ondrej Ján wrote: If users have python-xlrd installed, package maintainer should release only updates, which are API compatible with older versions. Right, the only API change between 0.6 and 0.9 is the removal of the 'pickleable' parameter to open_workbook. However, th

Re: SMTP-Email Help

2013-04-29 Thread Steven D'Aprano
On Sun, 28 Apr 2013 23:39:53 -0700, root.phidgets wrote: > Hi Guys. I need some help with the coding for my program. > > This coding is suppose to sort text file according to the latest date > and send the latest file. Attach it to my email and sent to another > email account. But somehow the pro