Re: how to get character hex number?

2012-08-31 Thread Peter Otten
Tim Chase wrote: > On 08/31/12 22:41, contro opinion wrote: >>> u"english".encode("utf-8") 'english' >>> u"english".encode("ascii") 'english' how can i get 656e676c697368 in encode method? >>> >>> At least in 2.x, you can do: >>> >>> >>> u"english".encode("hex") >>> '

Re: why i can't set locale?

2012-08-31 Thread Peter Otten
contro opinion wrote: locale.setlocale(locale.LC_ALL, 'gbk') > Traceback (most recent call last): > File "", line 1, in > File "/usr/lib/python2.6/locale.py", line 513, in setlocale > return _setlocale(category, locale) > locale.Error: unsupported locale setting Try picking one of t

Re: to know binary

2012-08-31 Thread Dave Angel
On 09/01/2012 12:59 AM, contro opinion wrote: 1) you top-posted 2) you replied privately, excluding the list from your query > the file is utf-8 format, str='/0x31/0x32/0x33/0x34' 3) No idea what that value is supposed to mean. Perhaps you intended to use backslashes here? And perhaps you

Async client for PostgreSQL?

2012-08-31 Thread Laszlo Nagy
Is there any extension for Python that can do async I/O for PostgreSQL with tornadoweb's ioloop? Something like: class MainHandler(tornado.web.RequestHandler): @tornado.web.asynchronous def get(self): pg_connection.(long_taking_query_sql,params,callback=self.on_query_opened)

Re: Unittest - testing for filenames and filesize

2012-08-31 Thread 88888 Dihedral
On Saturday, September 1, 2012 12:19:10 AM UTC+8, Chris Withers wrote: > On 23/08/2012 12:25, Tigerstyle wrote: > > > class FileTest(unittest.TestCase): > > > > > > def setUp(self): > > > self.origdir = os.getcwd() > > > self.dirname = tempfile.mkdtemp("testdir") > > >

Re: to know binary

2012-08-31 Thread Dave Angel
On 09/01/2012 12:15 AM, contro opinion wrote: > there is a only line in the file nanmed test: > 1234 > when i open it whit xxd > xxd test > what i get is : > 000: 3132 3334 0a 1234. > can you explain it ? > > > Explain what, exactly? Explain why you were able to

Re: to know binary

2012-08-31 Thread Chris Angelico
On Sat, Sep 1, 2012 at 2:15 PM, contro opinion wrote: > there is a only line in the file nanmed test: > 1234 > when i open it whit xxd > xxd test > what i get is : > 000: 3132 3334 0a 1234. > can you explain it ? I would explain it as a file with one line named

to know binary

2012-08-31 Thread contro opinion
there is a only line in the file nanmed test: 1234 when i open it whit xxd xxd test what i get is : 000: 3132 3334 0a 1234. can you explain it ? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get character hex number?

2012-08-31 Thread Tim Chase
On 08/31/12 22:41, contro opinion wrote: >> u"english".encode("utf-8") >>> 'english' >> u"english".encode("ascii") >>> 'english' >>> >>> how can i get 656e676c697368 in encode method? >> >> At least in 2.x, you can do: >> >> >>> u"english".encode("hex") >> '656e676c697368' > > how about i

Re: how to get character hex number?

2012-08-31 Thread Tim Chase
On 08/31/12 21:21, contro opinion wrote: for i in "english" : > ... print(hex((ord(i > ... > 0x65 > 0x6e > 0x67 > 0x6c > 0x69 > 0x73 > 0x68 u"english".encode("utf-8") > 'english' u"english".encode("ascii") > 'english' > > how can i get 656e676c697368 in encode method? At leas

Re: how to get character hex number?

2012-08-31 Thread Ian Kelly
On Fri, Aug 31, 2012 at 8:21 PM, contro opinion wrote: for i in "english" : > ... print(hex((ord(i > ... > 0x65 > 0x6e > 0x67 > 0x6c > 0x69 > 0x73 > 0x68 u"english".encode("utf-8") > 'english' u"english".encode("ascii") > 'english' > > how can i get 656e676c697368 in encode me

how to get character hex number?

2012-08-31 Thread contro opinion
>>> for i in "english" : ... print(hex((ord(i ... 0x65 0x6e 0x67 0x6c 0x69 0x73 0x68 >>> u"english".encode("utf-8") 'english' >>> u"english".encode("ascii") 'english' how can i get 656e676c697368 in encode method? -- http://mail.python.org/mailman/listinfo/python-list

why i can't set locale?

2012-08-31 Thread contro opinion
>>> locale.setlocale(locale.LC_ALL, 'gbk') Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/locale.py", line 513, in setlocale return _setlocale(category, locale) locale.Error: unsupported locale setting -- http://mail.python.org/mailman/listinfo/python-list

Re: thanks!

2012-08-31 Thread Ben Finney
Tim Chase writes: > Or we can take the opportunity to thank you for all your work on > making this a relatively spam-free mailing list. So thanks! Indeed. This forum has a very high signal-to-noise ratio, largely due to efforts that are often invisible to the participants. Thank you! -- \

Re: Looking for an IPC solution

2012-08-31 Thread Laszlo Nagy
Zeromq (suggested by someone) is an option since it's pretty fast for most purposes, but I don't think it uses shared memory. Interesting question. The documentation says: http://api.zeromq.org/2-1:zmq-ipc The inter-process transport is currently only implemented on operating systems that prov

Re: Looking for an IPC solution

2012-08-31 Thread Antoine Pitrou
Laszlo Nagy shopzeus.com> writes: > > There are just so many IPC modules out there. I'm looking for a solution > for developing a new a multi-tier application. The core application will > be running on a single computer, so the IPC should be using shared > memory (or mmap) and have very short

Re: Looking for an IPC solution

2012-08-31 Thread Paul Rubin
Laszlo Nagy writes: > application will be running on a single computer, so the IPC should be > using shared memory (or mmap) and have very short response times. Zeromq (suggested by someone) is an option since it's pretty fast for most purposes, but I don't think it uses shared memory. The close

Re: Looking for an IPC solution

2012-08-31 Thread Marco Nawijn
On Friday, August 31, 2012 9:22:00 PM UTC+2, Laszlo Nagy wrote: > There are just so many IPC modules out there. I'm looking for a solution > > for developing a new a multi-tier application. The core application will > > be running on a single computer, so the IPC should be using shared > > me

Re: [pyxl] xlrd-0.8.0 .xlsx formatting_info=True not implemented

2012-08-31 Thread Albert-Jan Roskam
Hi, As a work-around, you could use the CRAN R package XLConnect, using RPy or RPy2, to do what you want. IIRC it's based on Java, so it's not extremely fast. http://cran.r-project.org/web/packages/XLConnect/vignettes/XLConnect.pdf This is another package I just saw for the first time http://cra

Looking for an IPC solution

2012-08-31 Thread Laszlo Nagy
There are just so many IPC modules out there. I'm looking for a solution for developing a new a multi-tier application. The core application will be running on a single computer, so the IPC should be using shared memory (or mmap) and have very short response times. But there will be a tier that

Re: Tkinter bug in Entry widgets on OS X

2012-08-31 Thread Arnaud Delobelle
On 31 August 2012 16:41, Alister wrote: > On Fri, 31 Aug 2012 11:21:14 -0400, Kevin Walzer wrote: > >> On 8/31/12 11:18 AM, Arnaud Delobelle wrote: >> >> >>> I'm not trying to do anything. When a user presses the UP or DOWN >>> arrow, then a strange character is inserted in the Entry box. I'd >>

Re: thanks! (was "Test message - please ignore")

2012-08-31 Thread Ethan Furman
Tim Chase wrote: On 08/31/12 09:15, Skip Montanaro wrote: We just upgraded the Mailman installation on mail.python.org. Part of that installation includes spam filtering on messages gated from Usenet to the python- l...@python.org mailing list. This message is a quick test of that function.

Re: Unittest - testing for filenames and filesize

2012-08-31 Thread Chris Withers
On 23/08/2012 12:25, Tigerstyle wrote: class FileTest(unittest.TestCase): def setUp(self): self.origdir = os.getcwd() self.dirname = tempfile.mkdtemp("testdir") os.chdir(self.dirname) I wouldn't change directories like this, it's pretty fragile, just use absolu

Basic python extension producing error: "dynamic module not initialized properly"

2012-08-31 Thread Jason Veldicott
Hi, I am trying to create an extension to call into a c++ library, a library which simply returns a string, given a string. At first, a quick and simple approach was tried (based on post http://stackoverflow.com/questions/1615813/how-to-use-c-classes-with-ctypes) in which the usual infrastructure

Re: Tkinter bug in Entry widgets on OS X

2012-08-31 Thread Alister
On Fri, 31 Aug 2012 11:21:14 -0400, Kevin Walzer wrote: > On 8/31/12 11:18 AM, Arnaud Delobelle wrote: > > >> I'm not trying to do anything. When a user presses the UP or DOWN >> arrow, then a strange character is inserted in the Entry box. I'd >> rather nothing happened. >> > Why is the user

Re: Tkinter bug in Entry widgets on OS X

2012-08-31 Thread Kevin Walzer
On 8/31/12 11:18 AM, Arnaud Delobelle wrote: I'm not trying to do anything. When a user presses the UP or DOWN arrow, then a strange character is inserted in the Entry box. I'd rather nothing happened. Why is the user doing that? If they are trying to navigate to a different part of the int

Re: Tkinter bug in Entry widgets on OS X

2012-08-31 Thread Arnaud Delobelle
On 31 August 2012 15:25, Kevin Walzer wrote: > On 8/31/12 6:18 AM, Arnaud Delobelle wrote: >> >> I'm very inexperienced with Tkinter (I've never used it before). All >> I'm looking for is a workaround, i.e. a way to somehow suppress that >> output. > > > What are you trying to do? Navigate the fo

Re: Flexible string representation, unicode, typography, ...

2012-08-31 Thread Ian Kelly
On Fri, Aug 31, 2012 at 6:32 AM, Steven D'Aprano wrote: > That's one thing that I'm unclear about -- under what circumstances will > a string be in compact versus non-compact form? I understand it to be entirely dependent on which API is used to construct. The legacy API generates legacy strings

Re: Flexible string representation, unicode, typography, ...

2012-08-31 Thread Steven D'Aprano
On Fri, 31 Aug 2012 08:43:55 -0400, Roy Smith wrote: > In article <503f8e33$0$30001$c3e8da3$54964...@news.astraweb.com>, > Steven D'Aprano wrote: > >> On Thu, 30 Aug 2012 07:02:24 -0400, Roy Smith wrote: >> > Is the implementation smart enough to know that x == y is always >> > False if x and y

Re: Tkinter bug in Entry widgets on OS X

2012-08-31 Thread Kevin Walzer
On 8/31/12 6:18 AM, Arnaud Delobelle wrote: I'm very inexperienced with Tkinter (I've never used it before). All I'm looking for is a workaround, i.e. a way to somehow suppress that output. What are you trying to do? Navigate the focus to another widget? You should use the tab bar for that, n

Re: thanks! (was "Test message - please ignore")

2012-08-31 Thread Tim Chase
On 08/31/12 09:15, Skip Montanaro wrote: > We just upgraded the Mailman installation on mail.python.org. Part of that > installation includes spam filtering on messages gated from Usenet to the > python- > l...@python.org mailing list. This message is a quick test of that function. > > You c

Re: interfacing with x86_64 assembler

2012-08-31 Thread Mark Lawrence
On 31/08/2012 14:58, Grant Edwards wrote: On 2012-08-31, Mark Lawrence wrote: On 31/08/2012 14:40, lipska the kat wrote: I was hacking away at some x86_64 assembler today when I found myself obsessively indenting my code by EXACTLY 4 spaces or (multiples thereof) What's wrong with structu

Test message - please ignore

2012-08-31 Thread Skip Montanaro
We just upgraded the Mailman installation on mail.python.org. Part of that installation includes spam filtering on messages gated from Usenet to the python- l...@python.org mailing list. This message is a quick test of that function. You can ignore it. Skip Montanaro -- http://mail.python

Re: interfacing with x86_64 assembler

2012-08-31 Thread Grant Edwards
On 2012-08-31, Mark Lawrence wrote: > On 31/08/2012 14:40, lipska the kat wrote: >> I was hacking away at some x86_64 assembler today >> when I found myself obsessively indenting my code >> by EXACTLY 4 spaces or (multiples thereof) > What's wrong with structured assembler? :) Nothing -- it's c

Re: interfacing with x86_64 assembler

2012-08-31 Thread Mark Lawrence
On 31/08/2012 14:40, lipska the kat wrote: Worryingly I was hacking away at some x86_64 assembler today when I found myself obsessively indenting my code by EXACTLY 4 spaces or (multiples thereof) Who'd have thought it. lipska What's wrong with structured assembler? :) -- Cheers. Mark Law

interfacing with x86_64 assembler

2012-08-31 Thread lipska the kat
Worryingly I was hacking away at some x86_64 assembler today when I found myself obsessively indenting my code by EXACTLY 4 spaces or (multiples thereof) Who'd have thought it. lipska -- Lipska the Kat©: Troll hunter, sandbox destroyer and farscape dreamer of Aeryn Sun -- http://mail.python.or

Re: Flexible string representation, unicode, typography, ...

2012-08-31 Thread Roy Smith
In article <503f8e33$0$30001$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Thu, 30 Aug 2012 07:02:24 -0400, Roy Smith wrote: > > Is the implementation smart enough to know that x == y is always False > > if x and y are using different internal representations? > > [...] There

Re: Flexible string representation, unicode, typography, ...

2012-08-31 Thread Steven D'Aprano
On Thu, 30 Aug 2012 16:44:32 -0400, Terry Reedy wrote: > On 8/30/2012 12:00 PM, Steven D'Aprano wrote: >> On Thu, 30 Aug 2012 07:02:24 -0400, Roy Smith wrote: [...] >>> Is the implementation smart enough to know that x == y is always False >>> if x and y are using different internal representation

Re: XML parser: Element ordering?

2012-08-31 Thread Dave Angel
On 08/31/2012 08:21 AM, Stefan Behnel wrote: > Florian Lindner, 31.08.2012 14:03: >> I plan to use the etree.ElementTree XML parser to parse a config file >> in which the order of the elements matter, e.g.: >> >> >> >> >> >> is not equal to: >> >> >> >> >> >> I have found different answers to

Re: XML parser: Element ordering?

2012-08-31 Thread Stefan Behnel
Florian Lindner, 31.08.2012 14:03: > I plan to use the etree.ElementTree XML parser to parse a config file > in which the order of the elements matter, e.g.: > > > > > > is not equal to: > > > > > > I have found different answers to the question if order matters in XML > documents. So my

XML parser: Element ordering?

2012-08-31 Thread Florian Lindner
Hello, I plan to use the etree.ElementTree XML parser to parse a config file in which the order of the elements matter, e.g.: is not equal to: I have found different answers to the question if order matters in XML documents. So my question here: Does it matters (and is more or less guare

Re: Context manager to save/restore a name binding

2012-08-31 Thread Chris Withers
Hi Ben, On 31/08/2012 03:36, Ben Finney wrote: That way, I can set ‘sys.dont_write_bytecode’ to the value I need in this part of the code, knowing that however the code continues the previous value of that setting will be restored to whatever it was before I touched it. Have I re-invented a con

Tkinter bug in Entry widgets on OS X

2012-08-31 Thread Arnaud Delobelle
Hi all, I'm writing a small GUI on OS X (v. 10.7.4) using Tkinter. I'm using stock Python. It mostly works fine but there is a bug in Entry widgets: if and Entry widget has focus and I press the UP arrow, a "\uf700" gets inserted in the widget. If I press the DOWN arrow, a "\uf701" gets inserte

Re: Context manager to save/restore a name binding

2012-08-31 Thread Ben Finney
Peter Otten <__pete...@web.de> writes: > You should wrap yield in a try ... finally. You might allow setting > the new value in the manager (untested): Thank you, both good advice. I would still like to know if Python already has something to make this unnecessary. -- \ “Compulsory unifi

Re: Call perl to store data in DB

2012-08-31 Thread Mulla
On Friday, August 31, 2012 2:49:32 PM UTC+5:30, Octavian Rasnita wrote: > Maybe I didn't understand well, but if you want your Perl program to get and > store the data submitted by the form, then the action of the form should > point to the Perl script something like: > > > > > > > > So yo

Re: Call perl to store data in DB

2012-08-31 Thread Octavian Rasnita
Maybe I didn't understand well, but if you want your Perl program to get and store the data submitted by the form, then the action of the form should point to the Perl script something like: So your "form" object in Python should set the action as the path to the Perl program. --Octavian --

Re: Call perl to store data in DB

2012-08-31 Thread Mark Lawrence
On 31/08/2012 09:40, Mulla wrote: [snip] how can I do this ...>>? Look forward for hear from you soon Thank You Search the archives as it's the fourth time the question has been asked within a few weeks. -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list

Call perl to store data in DB

2012-08-31 Thread Mulla
hey, when i submit the form in html , the entered data (fname,lanme,uname.)all have to come in perl script to store that data in DB. Python View.py def ProfileRegistration(request): if request.user.is_authenticated(): return HttpResponseRedirect('/profile/') if request.met