A http server
Hi, I'm trying to set up a http server to handle a single POST request. That POST request is to upload a huge file and the server is supposed to handle it with the just POST request. With my python sample code, multiple post requests are working well, but that is not my solution. I need a single POST request handling in the http server side. Does anyone have a good idea for this case or sample code? TIA -- http://mail.python.org/mailman/listinfo/python-list
How to swallow traceback message
Hi, I run my py app to display a file's contents, and it is normally very long. So I use it like below: python myapp.py input_file | more to see them step by step. But when I try to exit it, normally I use Ctrl+ C key to quit it. Problem is every time I do like it, it shows Traceback message and it makes my app not professional. How do I handle it gracefully. TIA -- http://mail.python.org/mailman/listinfo/python-list
Re: How to swallow traceback message
On Aug 11, 11:19 am, Tim Harig user...@ilthio.net wrote: On 2010-08-11, Back9 backgoo...@gmail.com wrote: python myapp.py input_file | more to see them step by step. But when I try to exit it, normally I use Ctrl+ C key to quit it. Problem is every time I do like it, it shows Traceback message and it makes my app not professional. You have three options. 1. Exit more properly. 2. Catch and handle SIGINT yourself. 3. Wrap whatever section of your program is being interrupted in try/except to catch the KeyboardInterrupt exception when it is generated. I should have mentioned that I already use try/except KeyboardInterrupt statement. But it does not seem to work as I expected. TIA -- http://mail.python.org/mailman/listinfo/python-list
most popular gui framework for python
Hi, Does anyone know of what is the most popular gui framework for python application? TIA -- http://mail.python.org/mailman/listinfo/python-list
how to preserve hex value
Hi, When converting a hex value, I'd like to preserve the decimal position. For example, 0x0A is converted to 0A not just A in string. How do I do this? TIA -- http://mail.python.org/mailman/listinfo/python-list
struct
Can anyone explain the difference between f and d in struct unpack? When using them, some data work in either one not both. To me it seems to be same, TIA -- http://mail.python.org/mailman/listinfo/python-list
Regular expression
Hi, I have a string like this: 0x340x5A0x9B0xBA I want to extract 0x from the string but the first one. How I can use re for this case? The string size will vary. TIA -- http://mail.python.org/mailman/listinfo/python-list
Re: Regular expression
On May 18, 10:09 am, ilvecchio terenzio.be...@gmail.com wrote: On May 18, 3:48 pm, Back9 backgoo...@gmail.com wrote: Hi, I have a string like this: 0x340x5A0x9B0xBA I want to extract 0x from the string but the first one. How I can use re for this case? The string size will vary. TIA Maybe the easy way is something like this: m = re.match('(0x)(.*)','0x340x5A0x9B0xBA') m.groups()[1] Terenzio I mean the result should be like this: 0x345A9BBA -- http://mail.python.org/mailman/listinfo/python-list
default argument
Hi, Is this grammer working in Python? class test: self._value = 10 def func(self, self._value) When i try it, it complains about undefined self. i don't know why. TIA -- http://mail.python.org/mailman/listinfo/python-list
Re: default argument
On May 11, 3:06 pm, Back9 backgoo...@gmail.com wrote: Hi, Is this grammer working in Python? class test: self._value = 10 def func(self, self._value) When i try it, it complains about undefined self. i don't know why. TIA Sorry here is the what i meant class test: self._value = 10 def func(self, pos = self._value) -- http://mail.python.org/mailman/listinfo/python-list
Re: default argument
On May 11, 3:20 pm, Chris Rebert c...@rebertia.com wrote: On Tue, May 11, 2010 at 12:08 PM, Back9 backgoo...@gmail.com wrote: On May 11, 3:06 pm, Back9 backgoo...@gmail.com wrote: snip When i try it, it complains about undefined self. i don't know why. TIA Sorry here is the what i meant class test: self._value = 10 def func(self, pos = self._value) You're still defining the class, so how could there possibly be an instance of it to refer to as self yet (outside of a method body)? Also, just so you know, default argument values are only evaluated once, at the time the function/method is defined, so `pos = self._value` is never going to work. Do you mean for self._value to be a class variable (Java lingo: static variable), or an instance variable? Cheers, Chris --http://blog.rebertia.com self._value will be instance variable -- http://mail.python.org/mailman/listinfo/python-list