Web archtecture using two layers in Phyton
Hello, I need to develop an web applications that meet the following requirements: - 2 layers: the first one is the user interface (browser) and the second one is the interaction with the operacional system of the server. - the second layer must be developed using Python. I'd like to know if it is possible to implement this system... making the second layer using python and the first layer using another web technologies like AJAX for example. Does anybody have any experience in developing python web applications? Maybe send me some links or documentation about it... The final goal is to make diferent user interfaces (layer 1) that can integrate with the second layer... for example, one web interface and one local interface using python+qt (example)... i don't know if this is possible and how can this be implemented... any help is aprreciated... Thanks in advance, Wagner. -- http://mail.python.org/mailman/listinfo/python-list
nmea
can any1 help me on how to get python to read nmea data? -- http://mail.python.org/mailman/listinfo/python-list
wxpython and EVT_KILL_FOCUS
Hello, I am fighting with EVT_KILL_FOCUS for quite a time now and I don't succeed at all. Situation: If a user leaves a textfield the entered information should be checked and an additional window should be opened to make a search possible to complete the entry. Basic solution: def __init__(...): ... self.artikelnrBox = wxTextCtrl(self.bestelldialog, -1, artikelnr, wxPoint(60,290), wxSize(60, -1)) ... EVT_KILL_FOCUS(self.artikelnrBox, self.OnArtikel) ... def OnArtikel(self,event): event.Skip() artikelnr = self.artikelnrBox.GetValue().strip() ... dialog = dialog_stamm_artikel.ArtikelSucheDialog(self.bestelldialog,artikelnr) ergebnis,artikelid = dialog.GetValues() dialog.Destroy() ... Problem: If I don't open any dialog everything works fine. But if there is a dialog around the window opens, I can count to two and the whole application crashes. The error message is: (gui.py:29768): Gtk-WARNING **: GtkEntry - did not receive focus-out-event. If you connect a handler to this signal, it must return FALSE so the entry gets the event as well Gtk-ERROR **: file gtkentry.c: line 4919 (blink_cb): assertion failed: (GTK_WIDGET_HAS_FOCUS (entry)) aborting... Reason of the problem: I found a very good description for the reason: > This is a lot easier to understand with a timeline: > - focus into GtkEntry > - GtkEntry installs timeout for cursor blinking > - focus out of entry > - GtkEntry emits focus-out-event > - your handler runs **before the default handler**. > - your handler traps exception and creates dialog box > - dialog box runs nested event loop > - event processing continues, focus goes to another widget > - entry's cursor blink timeout is still installed, and runs again. > entry does not have focus, but timeout has run, so the widget > is in an invalid state and calls g_error() with a nastygram. > - default handler runs, uninstalls cursor blink timeout > The problem is that you're allowing the event loop to run in your handler for > focus-out. Ok, if I use EVT_KILL_FOCUS the event has not finished completly, this timeout is still around. That's ok with me but I thought this is what event.Skip() is for, to call the standard handler. Solution: And there I am. event.Skip() doesn't help at all. And the other source gives the following suggestion: > a) use signal_connect_after to have your handler run *after* the default > handler for focus-out-event instead of before. > b) leave the signal connected normally, but in your "catch" block, instead of > running the dialog right then, defer it with an idle, like this: I couldn't find signal_connect_after anywhere in wxpython and I don't know how to use idle in this case. And I have the problem more than once (every time a have an error message in other EVT_KILL_FOCUS routines). There must be some solution to use EVT_KILL_FOCUS and a dialog without killing the application. Please help! Steffi -- http://mail.python.org/mailman/listinfo/python-list
Writing Memory to File
Hi, I'm trying to do some memory analyzing stuff, i wrote me a small .c so far to dump the memory to a file for later analysis, the analyzing part itself is python code. I wonder if any of you has an idea how to dump the whole memory in Linux/Windows from python ? Using the .c for this somehow doesn't look right and comfy ;-) Regards, Stefan -- http://mail.python.org/mailman/listinfo/python-list
How to know if a module is thread-safe
Hi, I recently tried to use the subprocess module within a threading.Thread class, but it appears the module is not thread-safe. What is the policy of python regarding thread-safety of a module ? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Success stories
Sure. Python is more readable than Perl, though I have found Python to have a weird behavior regarding this little issue : How can you explain that Python doesn't support the ++ opeator, whereas at the same time it does support the += operator ??? No python developer I know has been able to answer that. Istvan Albert a écrit : On Apr 22, 6:25 am, azrael <[EMAIL PROTECTED]> wrote: A friend of mine i a proud PERL developer which always keeps making jokes on python's cost. This hurts. Please give me informations about realy famous aplications. you could show him what Master Yoda said when he compared Python to Perl http://www.personal.psu.edu/iua1/pythonvsperl.htm i. -- http://mail.python.org/mailman/listinfo/python-list
merge list of tuples with list
Hello Everyone, I'm new in this group and I hope it is ok to directly ask a question. My short question: I'm searching for a nice way to merge a list of tuples with another tuple or list. Short example: a = [(1,2,3), (4,5,6)] b = (7,8) After the merging I would like to have an output like: a = [(1,2,3,7), (4,5,6)] It was possible for me to create this output using a "for i in a" technique but I think this isn't a very nice way and there should exist a solution using the map(), zip()-functions I appreciate any hints how to solve this problem efficiently. Greetings, Daniel Wagner -- http://mail.python.org/mailman/listinfo/python-list
Re: merge list of tuples with list
On Oct 19, 8:35 pm, James Mills wrote: > On Wed, Oct 20, 2010 at 10:16 AM, Daniel Wagner > > wrote: > > My short question: I'm searching for a nice way to merge a list of > > tuples with another tuple or list. Short example: > > a = [(1,2,3), (4,5,6)] > > b = (7,8) > > > After the merging I would like to have an output like: > > a = [(1,2,3,7), (4,5,6)] > > What happens with the 8 in the 2nd tuple b ? O, I'm sorry! This was a bad typo: the output should look like: a = [(1,2,3,7), (4,5,6,8)] Greetings, Daniel -- http://mail.python.org/mailman/listinfo/python-list
Re: merge list of tuples with list
I used the following code to add a single fixed value to both tuples. But this is still not what I want... >>>a = [(1,2,3), (4,5,6)] >>>b = 1 >>>a = map(tuple, map(lambda x: x + [1], map(list, a))) >>>a [(1, 2, 3, 1), (4, 5, 6, 1)] What I need is: >>>a = [(1,2,3), (4,5,6)] >>>b = (7,8) >>> a = CODE >>>a [(1,2,3,7), (4,5,6,8)] Greetings, Daniel -- http://mail.python.org/mailman/listinfo/python-list
Re: merge list of tuples with list
SOLVED! I just found it out > I'm searching for a nice way to merge a list of > tuples with another tuple or list. Short example: > a = [(1,2,3), (4,5,6)] > b = (7,8) > > After the merging I would like to have an output like: > a = [(1,2,3,7), (4,5,6)] The following code solves the problem: >>> a = [(1,2,3), (4,5,6)] >>> b = [7,8] >>> a = map(tuple, map(lambda x: x + [b.pop(0)] , map(list, a))) >>> a [(1, 2, 3, 7), (4, 5, 6, 8)] Any more efficient ways or suggestions are still welcome! Greetings, Daniel -- http://mail.python.org/mailman/listinfo/python-list
Re: merge list of tuples with list
Many thanks for all these suggestions! here is a short proof that you guys are absolutely right and my solution is pretty inefficient. One of your ways: $ python /[long_path]/timeit.py 'a=[(1,2,3),(4,5,6)];b=(7,8);[x+(y,) for x,y in zip(a,b)]' 100 loops, best of 3: 1.44 usec per loop And my way: $ python /[long_path]/timeit.py 'a=[(1,2,3), (4,5,6)];b=[7,8];map(tuple, map(lambda x: x + [b.pop(0)] , map(list, a)))' 10 loops, best of 3: 5.33 usec per loop I really appreciate your solutions but they bring me to a new question: Why is my solution so inefficient? The same operation without the list/tuple conversion $ python /[long_path]/timeit.py 'a=[[1,2,3], [4,5,6]];b=[7,8];map(lambda x: x + [b.pop(0)] , a)' 10 loops, best of 3: 3.36 usec per loop is still horrible slow. Could anybody explain me what it makes so slow? Is it the map() function or maybe the lambda construct? Greetings, Daniel -- http://mail.python.org/mailman/listinfo/python-list
Re: merge list of tuples with list
> [b.pop(0)] > > This has to lookup the global b, resize it, create a new list, > concatenate it with the list x (which creates a new list, not an in-place > concatenation) and return that. The amount of work is non-trivial, and I > don't think that 3us is unreasonable. > I forgot to take account for the resizing of the list b. Now it makes sense. Thanks! > Personally, the approach I'd take is: > > a = [[1,2,3], [4,5,6]] > b = [7,8] > [x+[y] for x,y in zip(a,b)] > > > Speedwise: > > $ python -m timeit -s 'a=[[1,2,3], [4,5,6]]; b=[7,8]' '[x+[y] for x,y in > zip(a,b)]' > 10 loops, best of 3: 2.43 usec per loop > > > If anyone can do better than that (modulo hardware differences), I'd be > surprised. > Yeah, this seems to be a nice solution. Greetings, Daniel -- http://mail.python.org/mailman/listinfo/python-list
Dynamic RadioButton creation with Python + Qt
Hello, I'm trying to create dynamic RadioButton as follows: for i in out.keys(): msg = "radioButton_" + str(i) msg2 = 20 * x msg = QRadioButton(self.buttonGroup_interfaces, msg) msg.setGeometry(QRect(30,msg2,121,23)) msg.setTect(i) x += 1 The problem is that Python is creating all RadioButton as "msg" and not the value of "msg" so i can't access the RadioButton after the creation. Is there a way i can create the RadioButton with diferent names?? Thanks in advance, Wagner. -- http://mail.python.org/mailman/listinfo/python-list
Re: Dynamic RadioButton creation with Python + Qt
Thanks Fredrik, Your suggestion solved my problems! Thanks, Wagner. >From: Fredrik Lundh <[EMAIL PROTECTED]> >To: [email protected] >Subject: Re: Dynamic RadioButton creation with Python + Qt >Date: Mon, 21 Aug 2006 16:20:09 +0200 > >Wagner Garcia Campagner wrote: > > > I'm trying to create dynamic RadioButton as follows: > > > > for i in out.keys(): > > msg = "radioButton_" + str(i) > > msg2 = 20 * x > > msg = QRadioButton(self.buttonGroup_interfaces, msg) > > msg.setGeometry(QRect(30,msg2,121,23)) > > msg.setTect(i) > > x += 1 > > > > The problem is that Python is creating all RadioButton as "msg" and not >the > > value of "msg" so i can't access the RadioButton after the creation. > > > > Is there a way i can create the RadioButton with diferent names?? > >if you want to keep track of a list of things, store them in a list. > > > >-- >http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Web Archtecture using tow layers in Phyton
Hello, I need to develop an web applications that meet the following requirements: - 2 layers: the first one is the user interface (browser) and the second one is the interaction with the operacional system of the server. - the second layer must be developed using Python. I'd like to know if it is possible to implement this system... making the second layer using python and the first layer using another web technologies like AJAX for example. Does anybody have any experience in developing python web applications? Maybe send me some links or documentation about it... The final goal is to make diferent user interfaces (layer 1) that can integrate with the second layer... for example, one web interface and one local interface using python+qt (example)... i don't know if this is possible and how can this be implemented... any help is aprreciated... Thanks in advance, Wagner. - AVISO LEGAL: Esta mensagem eletrônica (e qualquer anexo) é confidencial e endereçada ao(s) indivíduo(s) referidos acima e a outros que tenham sido expressamente autorizados à recebe-la. Se você não é o destinatário(a) desta mensagem, por favor não copie, use ou divulgue seu conteúdo à outros. Caso você tenha recebido esta mensagem equivocadamente, por favor apague esta mensagem e eventuais copias. LEGAL NOTICE: This e-mail communication (and any attachments) is confidential and is intended only for the individual(s) named above and others who have been specifically authorized to receive it. If you are not the intended recipient, please do not read, copy, use or disclose the contents of this communication to others. Please then delete the e-mail and any copies of it. AVISO LEGAL: Este mensaje electrónico (y cualquier anexo) es confidencial y está dirigido exclusivamente a su(s) destinatario(s) arriba indicados y aquellos que hayan sido expresamente autorizados a recibirlo. Si usted no es el destinatario(s) de este mensaje, por favor no copie, use o divulgue el contenido a terceros. En caso que usted haya recibido este mensaje por error, por favor proceda a su destrucción y al de las posibles copias. -- http://mail.python.org/mailman/listinfo/python-list
RE: Web Archtecture using tow layers in Phyton
Thanks Amit, I'll search those python web framework and try to find what is the best for my needs. Thanks again for your help, Wagner. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Amit Khemka Sent: quinta-feira, 24 de maio de 2007 09:35 To: [email protected] Subject: Re: Web Archtecture using tow layers in Phyton On 5/23/07, Wagner Garcia Campagner <[EMAIL PROTECTED]> wrote: > Hello, > > I need to develop an web applications that meet the following requirements: > > - 2 layers: the first one is the user interface (browser) and the second one > is the interaction with the operacional system of the server. > - the second layer must be developed using Python. > > I'd like to know if it is possible to implement this system... making the > second layer using python and the first layer using another web technologies > like AJAX for example. Yes, It is very much possible and you will find the quite a few of such impementations . > Does anybody have any experience in developing python web applications? > Maybe send me some links or documentation about it... Search this news-group or web for "python web framework" and you can choose one based on your specific needs. ( some names that often pop up are: django, cherrypy, webware, pylons etc) > The final goal is to make diferent user interfaces (layer 1) that can > integrate with the second layer... for example, one web interface and one > local interface using python+qt (example)... i don't know if this is > possible and how can this be implemented... any help is aprreciated... Read the documentation of the framework ( if any) you choose to work with you may find templating system useful. For standalone app you can look at wxPython, which can communicate to your server at some port. Cheers, -- Amit Khemka -- onyomo.com Home Page: www.cse.iitd.ernet.in/~csd00377 Endless the world's turn, endless the sun's Spinning, Endless the quest; I turn again, back to my own beginning, And here, find rest. -- http://mail.python.org/mailman/listinfo/python-list - AVISO LEGAL: Esta mensagem eletrônica (e qualquer anexo) é confidencial e endereçada ao(s) indivíduo(s) referidos acima e a outros que tenham sido expressamente autorizados à recebe-la. Se você não é o destinatário(a) desta mensagem, por favor não copie, use ou divulgue seu conteúdo à outros. Caso você tenha recebido esta mensagem equivocadamente, por favor apague esta mensagem e eventuais copias. LEGAL NOTICE: This e-mail communication (and any attachments) is confidential and is intended only for the individual(s) named above and others who have been specifically authorized to receive it. If you are not the intended recipient, please do not read, copy, use or disclose the contents of this communication to others. Please then delete the e-mail and any copies of it. AVISO LEGAL: Este mensaje electrónico (y cualquier anexo) es confidencial y está dirigido exclusivamente a su(s) destinatario(s) arriba indicados y aquellos que hayan sido expresamente autorizados a recibirlo. Si usted no es el destinatario(s) de este mensaje, por favor no copie, use o divulgue el contenido a terceros. En caso que usted haya recibido este mensaje por error, por favor proceda a su destrucción y al de las posibles copias.-- http://mail.python.org/mailman/listinfo/python-list
