Re: Python, django datetime to string conversation helper

2011-11-30 Thread Казбек
On 1 дек, 11:03, Казбек wrote: > Online tool allows to select datetime to string format directives > quickly and to check result. Sorry, here is the link. http://datetostr.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Disable readline

2011-11-30 Thread Steven D'Aprano
On Thu, 01 Dec 2011 00:00:52 -0500, Roy Smith wrote: > Another possibility is setting your TERM environment variable to > something that readline can't support: > > ~$ TERM=asr33 > ~$ python > Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) [GCC 4.2.1 (Apple Inc. > build 5646)] on darwin Type "h

Re: Need some IPC pointers

2011-11-30 Thread Andrew Berg
On 11/30/2011 10:35 PM, Alec Taylor wrote: > Sure, I'll give you some pointers: I almost rephrased the subject line because I knew someone would make that joke. :P -- CPython 3.2.2 | Windows NT 6.1.7601.17640 | Thunderbird 7.0 -- http://mail.python.org/mailman/listinfo/python-list

Re: Python crashes on segmentation error

2011-11-30 Thread rusi
On Dec 1, 3:29 am, Terry Reedy wrote: > On 11/30/2011 7:58 AM, Christian Heimes wrote: > > > > > > > > > > > Am 30.11.2011 11:42, schrieb Ben Richardson: > >> Python crashes every time i run the following command… > > > import cv > >> Segmentation fault: 11 > > >> Python quit unexpectedly - an

Re: Need some IPC pointers

2011-11-30 Thread Alec Taylor
:P On Thu, Dec 1, 2011 at 4:02 PM, Roy Smith wrote: > In article , >  Alec Taylor wrote: > >> Sure, I'll give you some pointers: >> >> 0x3A28213A >> 0x6339392C >> 0x7363682E > > What, no 0xDEADBEEF ??? > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/

Re: Need some IPC pointers

2011-11-30 Thread Roy Smith
In article , Alec Taylor wrote: > Sure, I'll give you some pointers: > > 0x3A28213A > 0x6339392C > 0x7363682E What, no 0xDEADBEEF ??? -- http://mail.python.org/mailman/listinfo/python-list

Re: Disable readline

2011-11-30 Thread Roy Smith
In article <4ed6ffed$0$29986$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Is there a way to disable readline support in the interactive interpreter > at runtime? Either from within an existing session, or when the session > starts up will do. I'm assuming Python uses the stan

Re: Need some IPC pointers

2011-11-30 Thread Alec Taylor
Sure, I'll give you some pointers: 0x3A28213A 0x6339392C 0x7363682E -- http://mail.python.org/mailman/listinfo/python-list

Re: How convert a list string to a real list

2011-11-30 Thread Alec Taylor
Dammit, been awake too long researching on the Internet, but I finally reached the Last Page On Thu, Dec 1, 2011 at 3:25 PM, Ben Finney wrote: > Steven D'Aprano writes: > >> On Wed, 30 Nov 2011 17:12:10 -0500, Terry Reedy wrote: >> >> > I think it would be better if safe_eval were available as a

Re: How convert a list string to a real list

2011-11-30 Thread Ben Finney
Steven D'Aprano writes: > On Wed, 30 Nov 2011 17:12:10 -0500, Terry Reedy wrote: > > > I think it would be better if safe_eval were available as an easily > > accessible builtin and dangerous_eval were tucked away in a module ;-). > > +10 You do realise that any vote outside the range −1 thr

Disable readline

2011-11-30 Thread Steven D'Aprano
Is there a way to disable readline support in the interactive interpreter at runtime? Either from within an existing session, or when the session starts up will do. I am trying to test the behaviour of some interactive scripts which rely on readline. I have work-arounds for missing readline (su

Re: Clever hack or code abomination?

2011-11-30 Thread Matt Joiner
def possible_names(): yield "foo" for i in range(20): yield "foo-" + str(i) ಠ_ಠ On Thu, Dec 1, 2011 at 2:15 PM, Roy Smith wrote: > I need to try a bunch of names in sequence until I find one that works > (definition of "works" is unimportant).  The algorithm is: > > 1) Given a ba

Re: How convert a list string to a real list

2011-11-30 Thread Steven D'Aprano
On Wed, 30 Nov 2011 17:12:10 -0500, Terry Reedy wrote: > I think it would be better if safe_eval were available as an easily > accessible builtin and dangerous_eval were tucked away in a module ;-). +10 -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Clever hack or code abomination?

2011-11-30 Thread Steven D'Aprano
On Wed, 30 Nov 2011 22:15:27 -0500, Roy Smith wrote: > I need to try a bunch of names in sequence until I find one that works > (definition of "works" is unimportant). The algorithm is: > > 1) Given a base name, "foo", first see if just plain "foo" works. > > 2) If not, try "foo-1", "foo-2", an

Clever hack or code abomination?

2011-11-30 Thread Roy Smith
I need to try a bunch of names in sequence until I find one that works (definition of "works" is unimportant). The algorithm is: 1) Given a base name, "foo", first see if just plain "foo" works. 2) If not, try "foo-1", "foo-2", and so on 3) If you reach "foo-20", give up. What would you say i

Re: Need some IPC pointers

2011-11-30 Thread Chris Angelico
On Thu, Dec 1, 2011 at 8:03 AM, Andrew Berg wrote: > processes (that aren't necessarily written in Python) ... > non-local processes would be nice ... > The implementation needs to be cross-platform ... > I don't think I'll ever need to transfer anything complicated or large - > just strings or po

Re: unpack('>f', b'\x00\x01\x00\x00')

2011-11-30 Thread Ian Kelly
On Wed, Nov 30, 2011 at 3:24 PM, kuaile xu wrote: > Hi: > > I am working on a python script that parses mp4 video header. Once of > the field is a 32-bit fixed-point number. > > I know that the four bytes are: 00, 01, 00, 00. I have a third party > mp4 parsing program which displays this field's v

Re: unpack('>f', b'\x00\x01\x00\x00')

2011-11-30 Thread kuaile xu
On Nov 30, 6:02 pm, Chris Rebert wrote: > On Wed, Nov 30, 2011 at 2:24 PM, kuaile xu wrote: > > Hi: > > > I am working on a python script that parses mp4 video header. Once of > > the field is a 32-bit fixed-point number. > > > I know that the four bytes are: 00, 01, 00, 00. I have a third party

Re: How convert a list string to a real list

2011-11-30 Thread Tim Chase
On 11/30/11 16:48, Hidura wrote: Why you don't make this "['1','2','3']".strip("[]").split(',') work for me because it breaks on things like s = """ [[1,2,3],42,'''triple the fun!''', "can't touch this, eh?",r'"Back\\\slashes?!", she said.', [4,5,6]] """ Commas can be embedded in

Re: How convert a list string to a real list

2011-11-30 Thread Terry Reedy
On 11/30/2011 5:48 PM, Hidura wrote: Why you don't make this "['1','2','3']".strip("[]").split(',') work for me Look more carefully. This is not the same as ast.literal_eval(). >>> "['1','2','3']".strip("[]").split(',') ["'1'", "'2'", "'3'"] # list of 3-char strings >>> ast.literal_eval("['

Re: unpack('>f', b'\x00\x01\x00\x00')

2011-11-30 Thread Chris Rebert
On Wed, Nov 30, 2011 at 2:24 PM, kuaile xu wrote: > Hi: > > I am working on a python script that parses mp4 video header. Once of > the field is a 32-bit fixed-point number. > > I know that the four bytes are: 00, 01, 00, 00. I have a third party > mp4 parsing program which displays this field's v

Re: How convert a list string to a real list

2011-11-30 Thread Hidura
Why you don't make this "['1','2','3']".strip("[]").split(',') work for me El nov 30, 2011 10:16 p.m., "Terry Reedy" escribió: > On 11/30/2011 3:58 AM, Peter Otten wrote: > >> Terry Reedy wrote: >> >> On 11/30/2011 1:20 AM, 郭军权 wrote: >>> Good after I have a string liststr = '["","

Re: Need some IPC pointers

2011-11-30 Thread Irmen de Jong
On 30-11-11 23:28, Irmen de Jong wrote: On 30-11-11 22:03, Andrew Berg wrote: processes (that aren't necessarily written in Python) and communicates Oops, missed this on my first read. This rules out my suggestion of Pyro because that requires Python on both ends (or Java/.net on the client

Re: Need some IPC pointers

2011-11-30 Thread Devin Jeanpierre
> Sounds interesting, but I'm not familiar with threading (not that I > wouldn't be willing to learn). > Is it even possible to pipe into a running process, though? You create the pipe to the process when you start it. e.g. subprocess.Popen(['ls', 'foo'], stdout=subprocess.PIPE, stdin=subproc

Re: Need some IPC pointers

2011-11-30 Thread Irmen de Jong
On 30-11-11 22:03, Andrew Berg wrote: I've done some research, but I'm not sure what's most appropriate for my situation. What I want to do is have a long running process that spawns processes (that aren't necessarily written in Python) and communicates with them. The children can be spawned at a

Re: Python crashes on segmentation error

2011-11-30 Thread Terry Reedy
On 11/30/2011 7:58 AM, Christian Heimes wrote: Am 30.11.2011 11:42, schrieb Ben Richardson: Python crashes every time i run the following command… import cv Segmentation fault: 11 Python quit unexpectedly - any help would be greatly appreciated - thankyou in advance :) Here is crash report…

unpack('>f', b'\x00\x01\x00\x00')

2011-11-30 Thread kuaile xu
Hi: I am working on a python script that parses mp4 video header. Once of the field is a 32-bit fixed-point number. I know that the four bytes are: 00, 01, 00, 00. I have a third party mp4 parsing program which displays this field's value is:1.0. However, the struct.unpack gets a value of 0.0.

Re: Need some IPC pointers

2011-11-30 Thread Andrew Berg
On 11/30/2011 3:32 PM, Devin Jeanpierre wrote: > You could also use threads and pipes. (I'm not actually > sure how threads+pipes works, but I'm told that it's a viable > approach). Sounds interesting, but I'm not familiar with threading (not that I wouldn't be willing to learn). Is it even possibl

Re: Py and SQL

2011-11-30 Thread Jerry Hill
On Wed, Nov 30, 2011 at 3:30 PM, Verde Denim wrote: > dbCursor1.execute('select lpad(' ', 2*level) || c "Privilege, Roles and > Users" from ( select null p, name c from system_privilege_map where name > like upper(\'%&enter_privliege%\') union select granted_role p, grantee c > from dba_role_priv

Re: How convert a list string to a real list

2011-11-30 Thread Terry Reedy
On 11/30/2011 3:58 AM, Peter Otten wrote: Terry Reedy wrote: On 11/30/2011 1:20 AM, 郭军权 wrote: Good after I have a string liststr = '["","","ccc"]' ,and I need convert it to a list like list = ["","","ccc"],what can id do? The easiest -- and most dangerous -- way is >>> ev

Re: Need some IPC pointers

2011-11-30 Thread Devin Jeanpierre
> I'm thinking sockets, but perhaps there's something simpler/easier. Sockets are the only thing that will work without threads on all platforms. You could also use threads and pipes. (I'm not actually sure how threads+pipes works, but I'm told that it's a viable approach). Usually things are sim

Re: Need some IPC pointers

2011-11-30 Thread Miki Tebeka
There are two different problems. One is the medium to pass messages, sockets are good but there are other options and depends on your requirement you need to pick the best one. The other is serialization format, here you have marshal, pickle, JSON, XML and more. For me JSON over sockets works

Need some IPC pointers

2011-11-30 Thread Andrew Berg
I've done some research, but I'm not sure what's most appropriate for my situation. What I want to do is have a long running process that spawns processes (that aren't necessarily written in Python) and communicates with them. The children can be spawned at any time and communicate at any time. Bei

Re: Py and SQL

2011-11-30 Thread Rod Person
On Wed, 30 Nov 2011 15:30:48 -0500 Verde Denim wrote: > All > I have a sql script that I've included in a simple Py file that gives > an error in the SQL. The problem is that the SQL code executes > correctly in a database IDE environment (in this case ora developer). > So, I'm concluding that I'

Py and SQL

2011-11-30 Thread Verde Denim
All I have a sql script that I've included in a simple Py file that gives an error in the SQL. The problem is that the SQL code executes correctly in a database IDE environment (in this case ora developer). So, I'm concluding that I'm doing something amiss in the Py code. Does anyone see why this c

Re: Py2.7/FreeBSD: maximum number of open files

2011-11-30 Thread Chris Torek
In article Christian Heimes wrote: >Am 14.11.2011 19:28, schrieb Tobias Oberstein: >> Thanks! This is probably the most practical option I can go. >> >> I've just tested: the backported new IO on Python 2.7 will indeed >> open >32k files on FreeBSD. It also creates the files much faster. >> The

Re: Defining a new base-type in Python based off Hexavigesimal

2011-11-30 Thread Peter Otten
Alec Taylor wrote: > On Thu, Dec 1, 2011 at 3:18 AM, Ian Kelly wrote: >> On Wed, Nov 30, 2011 at 8:19 AM, Alec Taylor >> wrote: >>> Good evening, >>> >>> I have defined a new numbering structure for certain mathematical >>> advantages. >>> >>> How do I implement this in Python, or would I be bet

Re: Defining a new base-type in Python based off Hexavigesimal

2011-11-30 Thread Alec Taylor
Excellent, I'll see if I can implement that. I was thinking more base data-type, but that seems impossible in python. 17 iterations (rarghh!) But yeah, I'll try that, thanks. On Thu, Dec 1, 2011 at 5:38 AM, Ian Kelly wrote: > On Wed, Nov 30, 2011 at 9:26 AM, Alec Taylor wrote: >> On Thu, Dec

How to get a correct entry in the menu for a Python application on Mac OS X

2011-11-30 Thread Detlev Offenbach
Hello, I am fairly new to Mac OS X and would like to know, what I have to do to make my Python application show the correct name in the menu bar. What did I do so far. I created an application package containing the .plist file with correct entries and a shell script, that starts the correct P

Re: Defining a new base-type in Python based off Hexavigesimal

2011-11-30 Thread Ian Kelly
On Wed, Nov 30, 2011 at 9:26 AM, Alec Taylor wrote: > On Thu, Dec 1, 2011 at 3:18 AM, Ian Kelly wrote: >> On Wed, Nov 30, 2011 at 8:19 AM, Alec Taylor wrote: >>> Good evening, >>> >>> I have defined a new numbering structure for certain mathematical >>> advantages. >>> >>> How do I implement th

Re: python 2.5 and ast

2011-11-30 Thread Andrea Crotti
Another thing about the AST, I am having fun trying to for example list out all the unused imports. I have already a visitor which works quite nicely I think, but now I would like to get a way to find all the unused imports, so I need more visitors that find out all the used names. I didn't f

tp_new, tp_alloc, tp_init

2011-11-30 Thread Michael Hennebry
I've been reading about writing extension types in C and am rather fuzzy about the relationship between tp_new, tp_alloc and tp_init. Most especially, why tp_new? It seems to me that tp_alloc and tp_init would be sufficient. Most of my reading has been in the Noddy and Shoddy portions of docs.pyth

Re: Defining a new base-type in Python based off Hexavigesimal

2011-11-30 Thread Devin Jeanpierre
> Care to translate it into English? > > Then translate the English into pseudo-code. And the pseudo-code into > Python. Then, if and only if the Python version is too slow, translate it > into C. And now you are done! Mathematical English is pseudocode. Related: all theorems are also programs and

Re: Defining a new base-type in Python based off Hexavigesimal

2011-11-30 Thread Alec Taylor
On Thu, Dec 1, 2011 at 3:18 AM, Ian Kelly wrote: > On Wed, Nov 30, 2011 at 8:19 AM, Alec Taylor wrote: >> Good evening, >> >> I have defined a new numbering structure for certain mathematical advantages. >> >> How do I implement this in Python, or would I be better off writing >> this in C or C++

Re: Defining a new base-type in Python based off Hexavigesimal

2011-11-30 Thread Ian Kelly
On Wed, Nov 30, 2011 at 8:19 AM, Alec Taylor wrote: > Good evening, > > I have defined a new numbering structure for certain mathematical advantages. > > How do I implement this in Python, or would I be better off writing > this in C or C++? > > Ultra concise definition: http://i42.tinypic.com/af7

Re: Defining a new base-type in Python based off Hexavigesimal

2011-11-30 Thread Peter Otten
Alec Taylor wrote: > I have defined a new numbering structure for certain mathematical > advantages. > > How do I implement this in Python, or would I be better off writing > this in C or C++? > > Ultra concise definition: http://i42.tinypic.com/af7w4h.png > LaTeX source: http://pastebin.tlhiv.o

Re: Defining a new base-type in Python based off Hexavigesimal

2011-11-30 Thread Steven D'Aprano
On Thu, 01 Dec 2011 02:19:31 +1100, Alec Taylor wrote: > Good evening, > > I have defined a new numbering structure for certain mathematical > advantages. > > How do I implement this in Python, or would I be better off writing this > in C or C++? > > Ultra concise definition: http://i42.tinypic

Defining a new base-type in Python based off Hexavigesimal

2011-11-30 Thread Alec Taylor
Good evening, I have defined a new numbering structure for certain mathematical advantages. How do I implement this in Python, or would I be better off writing this in C or C++? Ultra concise definition: http://i42.tinypic.com/af7w4h.png LaTeX source: http://pastebin.tlhiv.org/Kf6jPRkI Thanks f

Re: Converting MS Access DB to Postgres or MySQL for ORM support with SQLalchemy

2011-11-30 Thread Miki Tebeka
You can read data using win32com (ADODB?) and then write it to the desired database using the right package (psycopg2 ...). See example for reading data at http://mail.python.org/pipermail/python-win32/2006-March/004420.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3 - xml - crlf handling problem

2011-11-30 Thread Stefan Behnel
durumdara, 30.11.2011 13:08: As I see that XML parsing is "wrong" in Python. You didn't say what you are using for parsing, but from your example, it appears likely that you are using the xml.dom.minidom module. I must use predefined XML files, parsing them, extending them, and produce som

Re: Python crashes on segmentation error

2011-11-30 Thread Christian Heimes
Am 30.11.2011 11:42, schrieb Ben Richardson: > Python crashes every time i run the following command… > import cv > Segmentation fault: 11 > > Python quit unexpectedly - any help would be greatly appreciated - > thankyou in advance :) > > Here is crash report… [...] > > Thread 0 Crashed::

Re: order independent hash?

2011-11-30 Thread Peter Otten
Neal Becker wrote: > I like to hash a list of words (actually, the command line args of my > program) in such a way that different words will create different hash, > but not sensitive to the order of the words. Any ideas? You mean a typical python hash value which would be /likely/ to differ fo

Re: order independent hash?

2011-11-30 Thread Tim Golden
On 30/11/2011 12:32, Neal Becker wrote: I like to hash a list of words (actually, the command line args of my program) in such a way that different words will create different hash, but not sensitive to the order of the words. Any ideas? How about? hash (frozenset ("hello world".split ()))

order independent hash?

2011-11-30 Thread Neal Becker
I like to hash a list of words (actually, the command line args of my program) in such a way that different words will create different hash, but not sensitive to the order of the words. Any ideas? -- http://mail.python.org/mailman/listinfo/python-list

Python 3 - xml - crlf handling problem

2011-11-30 Thread durumdara
Hi! As I see that XML parsing is "wrong" in Python. I must use predefined XML files, parsing them, extending them, and produce some result. But as I see that in Windows this is working wrong. When the predefined XMLs are "formatted" (prettied) with CRLFs, then the parser keeps these plus LF cha

Re: Total newbie question: Best practice

2011-11-30 Thread Pedro Henrique G. Souto
On 30/11/2011 06:50, Shambhu Rajak wrote: Collins Congratulations for your first step into Python Programming. You can call them script or programs(not necessarily but depends on what your coding for). Yaa..it's always a good practice to call it through main(), but it doesn't really matter you

Python crashes on segmentation error

2011-11-30 Thread Ben Richardson
Hi! Python crashes every time i run the following command… >>> import cv Segmentation fault: 11 Python quit unexpectedly - any help would be greatly appreciated - thankyou in advance :) Here is crash report… Process: Python [276] Path:/Library/Frameworks/Python.framework/V

Re: cmd.Cmd asking questions?

2011-11-30 Thread Robert Kern
On 11/30/11 3:30 AM, Cameron Simpson wrote: On 29Nov2011 13:37, Tim Chase wrote: | On 11/28/11 06:27, Robert Kern wrote: [...] |>I actually have a preference for needing to press enter for |>Y/N answers, too. It's distinctly *less* uniform to have some |>questions requiring an enter and some not

Re: Debug python from DLL callback?

2011-11-30 Thread Fabio Zadrozny
On Wed, Nov 30, 2011 at 7:34 AM, Jason Veldicott wrote: > Hi, > > I am wondering if anyone here might be able to suggest if there is a way of > switching over from python execution into debug mode of an IDE, from python > code that is executed as a callback from a C++ DLL? > Use a remote debugger

Debug python from DLL callback?

2011-11-30 Thread Jason Veldicott
Hi, I am wondering if anyone here might be able to suggest if there is a way of switching over from python execution into debug mode of an IDE, from python code that is executed as a callback from a C++ DLL? Thanks Jason -- http://mail.python.org/mailman/listinfo/python-list

RE: Total newbie question: Best practice

2011-11-30 Thread Shambhu Rajak
Collins Congratulations for your first step into Python Programming. You can call them script or programs(not necessarily but depends on what your coding for). Yaa..it's always a good practice to call it through main(), but it doesn't really matter you can call the method in way Regards,

Re: How convert a list string to a real list

2011-11-30 Thread Peter Otten
Terry Reedy wrote: > On 11/30/2011 1:20 AM, 郭军权 wrote: >> Good after >> I have a string liststr = '["","","ccc"]' ,and I need convert it >> to a list like list = ["","","ccc"],what can id do? > > The easiest -- and most dangerous -- way is > >>> eval('["","","ccc"]') > ['