Re: Python for embedded systems?

2011-02-23 Thread Rafe Kettler
On Feb 23, 6:53 pm, Paulito wrote: > Apologies if this has been asked; I haven't yet Googled the archives. > > From a brief email conversation, Guido pointed me to this newsgroup to > ask the following questions: > > "Is Python 'mature' enough to be considered the primary language for > embedded s

Re: Python for embedded systems?

2011-02-23 Thread Paul Rubin
Paulito writes: > "Is Python 'mature' enough to be considered the primary language for > embedded systems? Is the performance there for real-time applications > (eg avionics, real-time control systems) or is it still more suitable > "...as a glue language, used to combine components written in C+

Re: Re: Securing files

2011-02-23 Thread Dr Vangel
On Wed, Feb 23, 2011 at 11:48 AM, Timothy W. Grove wrote: Hello Folks, In a python application that I'm developing I've been asked to add security to databases that the program might create and access; the database is to be password protected by its creator. The application uses an SQLite

Re: pattern matching

2011-02-23 Thread Dr Vangel
if I have a string such as '01/12/2011' and i want to reformat it as '20110112', how do i pull out the components of the string and reformat them into a DDMM format? I have: import re test = re.compile('dd/') f = open('test.html') # This file contains the html dates for line in f: if

Re: pattern matching

2011-02-23 Thread Roy Smith
In article , Chris Rebert wrote: > regex = compile("(\d\d)/(\d\d)/(\d{4})") I would probably write that as either r"(\d{2})/(\d{2})/(\d{4})" or (somewhat less likely) r"(\d\d)/(\d\d)/(\d\d\d\d)" Keeping to one consistent style makes it a little easier to read. Also, don't forget the leadi

Re: pattern matching

2011-02-23 Thread Chris Rebert
On Wed, Feb 23, 2011 at 6:37 PM, Steven D'Aprano wrote: > On Wed, 23 Feb 2011 21:11:53 -0500, monkeys paw wrote: >> if I have a string such as '01/12/2011' and i want to reformat >> it as '20110112', how do i pull out the components of the string and >> reformat them into a DDMM format? > > da

Re: pattern matching

2011-02-23 Thread Steven D'Aprano
On Wed, 23 Feb 2011 21:11:53 -0500, monkeys paw wrote: > if I have a string such as '01/12/2011' and i want to reformat > it as '20110112', how do i pull out the components of the string and > reformat them into a DDMM format? data = '01/12/2011' # Throw away tags. data = data[4:-5] # Separat

Re: pattern matching

2011-02-23 Thread Roy Smith
In article , monkeys paw wrote: > if I have a string such as '01/12/2011' and i want > to reformat it as '20110112', how do i pull out the components > of the string and reformat them into a DDMM format? > > I have: > > import re > > test = re.compile('\d\d\/') > f = open('test.html') #

Re: Re: Running Scripts vs Interactive mode

2011-02-23 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Ben Finney wrote: grobs456 writes: I realize I can double click on a .py file and Windows treats it as an executable but the command prompt pops in and out so quickly that I can't see the results of my script. Don't do that, then :-) You can open a persistent term

Re: Is setdefaultencoding bad?

2011-02-23 Thread Nobody
On Wed, 23 Feb 2011 04:14:29 -0800, Chris Rebert wrote: >> Ok, but that the interface handles UTF-8 strings >> are still ok? The defaultencoding is still ascii. > > Yes, that's fine. UTF-8 is an excellent encoding choice, and > encoding/decoding should always be done explicitly in Python, so the

pattern matching

2011-02-23 Thread monkeys paw
if I have a string such as '01/12/2011' and i want to reformat it as '20110112', how do i pull out the components of the string and reformat them into a DDMM format? I have: import re test = re.compile('\d\d\/') f = open('test.html') # This file contains the html dates for line in f:

Re: subprocess pipe question

2011-02-23 Thread Rob Williscroft
Rita wrote in news:AANLkTi=88dcpm_kqrs2g620obsnxz0majubfwpeme...@mail.gmail.com in gmane.comp.python.general: [Top post relocated] > On Tue, Feb 22, 2011 at 7:57 PM, Rob Williscroft > wrote: > >> Rita wrote in >> news:AANLkTi=w95gxosc1tkt2bntgjqys1cbmdnojhokq4...@mail.gmail.com in >> gmane.co

Re: QWebView: notify python when I clicked on a certain web eleemnt

2011-02-23 Thread Gelonida
Thanks Ian, Pls see my other reply. Is that what you meant? On 02/24/2011 12:25 AM, Ian Kelly wrote: > On Wed, Feb 23, 2011 at 4:02 PM, Gelonida wrote: >>> so make a Python object with some methods you'd wish to call, then >>> evaluate some small JS that will bind the click event on your elemen

Re: QWebView: notify python when I clicked on a certain web eleemnt

2011-02-23 Thread Gelonida
Damjan, Thanks once more for your help. You pointed me in the right direction. On 02/24/2011 12:25 AM, Ian Kelly wrote: > On Wed, Feb 23, 2011 at 4:02 PM, Gelonida wrote: >>> so make a Python object with some methods you'd wish to call, then >>> evaluate some small JS that will bind the click e

Re: Running Scripts vs Interactive mode

2011-02-23 Thread Terry Reedy
On 2/23/2011 5:22 PM, grobs456 wrote: Hi, I am trying to work through the tutorial at: http://docs.python.org/tutorial/ The issue I am facing is with regards to the discussion about "Invoking the Interpreter" and "Executable Python Scripts". It was rather hazy in my opinion. An alternative to

Re: Running Scripts vs Interactive mode

2011-02-23 Thread Rhodri James
On Wed, 23 Feb 2011 23:54:22 -, Ben Finney wrote: grobs456 writes: I realize I can double click on a .py file and Windows treats it as an executable but the command prompt pops in and out so quickly that I can't see the results of my script. Don't do that, then :-) You can open a pe

Re: lxml

2011-02-23 Thread MRAB
On 24/02/2011 00:10, Colin J. Williams wrote: Could someone please let me know whether lxml is available for Windows XP?. If so, is it available for Python 2.7? The latest stable release is here: http://pypi.python.org/pypi/lxml/2.2.8 -- http://mail.python.org/mailman/listinfo/python-list

Re: Porting Python2 C-API/Swig based modules to Python 3

2011-02-23 Thread Adam Pridgen
Link to pastebin: http://pastebin.com/102fhkgp On Wed, Feb 23, 2011 at 6:18 PM, Adam Pridgen wrote: > Thanks for the help.  That information got me started in the right > direction.  I put my notes up on paste bin for others to use in the > future. > > For the future reference of others, I have i

Re: Porting Python2 C-API/Swig based modules to Python 3

2011-02-23 Thread Adam Pridgen
Thanks for the help. That information got me started in the right direction. I put my notes up on paste bin for others to use in the future. For the future reference of others, I have included the pertinent details below. My process for identifying the various issues was compiling and running t

lxml

2011-02-23 Thread Colin J. Williams
Could someone please let me know whether lxml is available for Windows XP?. If so, is it available for Python 2.7? Thanks, Colin W. -- http://mail.python.org/mailman/listinfo/python-list

Re: Running Scripts vs Interactive mode

2011-02-23 Thread Ben Finney
grobs456 writes: > I am trying to work through the tutorial at: > http://docs.python.org/tutorial/ Excellent! I heartily encourage everyone to do this when learning Python: *work through* (not just read) the tutorial. Good for you! > I realize I can double click on a .py file and Windows treats

Python for embedded systems?

2011-02-23 Thread Paulito
Apologies if this has been asked; I haven't yet Googled the archives. >From a brief email conversation, Guido pointed me to this newsgroup to ask the following questions: "Is Python 'mature' enough to be considered the primary language for embedded systems? Is the performance there for real-time

Re: Python programming books

2011-02-23 Thread Joel Koltner
"John Bokma" wrote in message news:87oc63nvuo@castleamber.com... I also like the "Python Essential Reference" a lot. I'd second that. "Python Essential Reference" effectively documents the "batteries included" aspect of Python, using lots of good examples in a quite readable tome. --

Re: Running Scripts vs Interactive mode

2011-02-23 Thread n00m
Add into each your *.py script and as the very last line this: raw_input('Press any key to exit...') Or, even better, I'd recommend this free Python Editor: http://pythonide.stani.be/ SPE IDE - Stani's Python Editor Free python IDE for Windows,Mac & Linux with UML,PyChecker,Debugger, GUI design,Bl

Re: QWebView: notify python when I clicked on a certain web eleemnt

2011-02-23 Thread Ian Kelly
On Wed, Feb 23, 2011 at 4:02 PM, Gelonida wrote: >> so make a Python object with some methods you'd wish to call, then >> evaluate some small JS that will bind the click event on your element to >> the method of the Python object. >> > > OK, but how do I make sure, that I don't override an existin

Re: Securing files

2011-02-23 Thread entliczek
Can't you just create a new user and a special group for him and limit access privileges to that precise folder only to that user/group? That way only "the mysterious application" would be able to access them. It's perfect and very simple solution. Storing especially video files (that are usua

Re: QWebView: notify python when I clicked on a certain web eleemnt

2011-02-23 Thread Gelonida
Hi Damjan, Thanks for your answer On 02/21/2011 05:09 PM, Дамјан Георгиевски wrote: >> I have a web page (existing page, can't modify it) and I would like >> to browse it in a QtWebview. (This is already working >> When I click on a certain element e.g. "" >> I would like to notify my python scr

urllib2 header casing discrepancy

2011-02-23 Thread Darren Spruell
Spent some time tripping today over HTTP headers being added to the Request object in "proper" header case (all components title cased) but finding that the resulting header dictionary object had the headers keyed with first component only capitalized. ## http://paste.pound-python.org/show/3273/

Running Scripts vs Interactive mode

2011-02-23 Thread grobs456
Hi, I am trying to work through the tutorial at: http://docs.python.org/tutorial/ The issue I am facing is with regards to the discussion about "Invoking the Interpreter" and "Executable Python Scripts". It was rather hazy in my opinion. see: http://docs.python.org/tutorial/interpreter.html I r

Re: Python fails on math

2011-02-23 Thread John Nagle
On 2/22/2011 9:59 AM, Roy Smith wrote: In article, Grant Edwards wrote: Python doesn't do equations. Python does floating point operations. More generally, all general-purpose programming languages have the same problem. You'll see the same issues in Fortran, C, Java, Ruby, Pascal, etc,

Re: How to compile on OS X PPC? was: Re: [RELEASED] Python 3.2

2011-02-23 Thread Irmen de Jong
On 23-02-11 02:15, Ned Deily wrote: Unfortunately, this is a variation of an old issue that hasn't yet been fixed (http://bugs.python.org/issue1099). The simplest workaround is to include the --enable-universalsdk option to configure, so something like this: ./configure --enable-framework --en

Re: Securing files

2011-02-23 Thread Roy Smith
In article , "Timothy W. Grove" wrote: > The problem isn't so much the database itself, as I can think of a > number of way to encrypt the data it contains, but some of the data is > simply names of image and video files contained elsewhere in the > file-system. Is there anyway to prevent a u

Re: Securing files

2011-02-23 Thread geremy condra
On Wed, Feb 23, 2011 at 11:48 AM, Timothy W. Grove wrote: > Hello Folks, > > In a python application that I'm developing I've been asked to add security > to databases that the program might create and access; the database is to be > password protected by its creator. The application uses an SQLit

Securing files

2011-02-23 Thread Timothy W. Grove
Hello Folks, In a python application that I'm developing I've been asked to add security to databases that the program might create and access; the database is to be password protected by its creator. The application uses an SQLite database, which could be changed for another back-end if that

Re: Porting Python2 C-API/Swig based modules to Python 3

2011-02-23 Thread casevh
On Feb 23, 8:54 am, Adam Pridgen wrote: > Hello, > > I am trying to get a compiled module to work with Python3.  The code I > am compiling was originally intended to be used in a Python 2.* > environment, but I updated all the Python 2.* elements and the swig > commands used by the setup.py script

Re: ctypes inheritance issue

2011-02-23 Thread Steve
On Feb 23, 12:38 am, Carl Banks wrote: > Steve wrote: > > I've filed a bug in python but I wanted to see if other ctypes users/ > > experts viewed this issue as a bug. > > Consider the following: > > python code: > > import ctypes > > class my_array( ctypes.Array ): > >     _type_    = ctypes.c_ui

CentOS 5.5 x86_64 rpmbuild from source

2011-02-23 Thread William S .
When I run I'm attempting to run "rpmbuild -ba SPECS/python-2.7.spec" I get the following error: ERROR 0001: file '/usr/lib/python2.7/lib-dynload/_bsddb.so' contains a standard rpath '/usr/lib64' in [/usr/lib64] ERROR 0001: file '/usr/lib/python2.7/lib-dynload/_sqlite3.so' contains a s

Re: Trouble installing numpy on QNX

2011-02-23 Thread Robert Kern
On 2/23/11 10:16 AM, Nelson Powell wrote: I'm currently using QNX 6.4.1 with Python 2.5. I went to install numpy 1.4.1, but the install kicks bakc an error saying that it cannot find Python.h and that I should install python-dev|python-devel. I look online and I can only find those two packages

Porting Python2 C-API/Swig based modules to Python 3

2011-02-23 Thread Adam Pridgen
Hello, I am trying to get a compiled module to work with Python3. The code I am compiling was originally intended to be used in a Python 2.* environment, but I updated all the Python 2.* elements and the swig commands used by the setup.py script. I got the library to successfully compile, but I

Trouble installing numpy on QNX

2011-02-23 Thread Nelson Powell
I'm currently using QNX 6.4.1 with Python 2.5. I went to install numpy 1.4.1, but the install kicks bakc an error saying that it cannot find Python.h and that I should install python-dev|python-devel. I look online and I can only find those two packages in relation to Ubuntu, which obviously will

Re: Python fails on math

2011-02-23 Thread Grant Edwards
On 2011-02-23, Terry Reedy wrote: > On 2/22/2011 2:42 PM, Grant Edwards wrote: > >> Except that Python (and computer languages in general) don't deal with >> real numbers. They deal with floating point numbers, which aren't the >> same thing. [In case anybody is still fuzzy about that.] > > In p

Re: Creating Long Lists

2011-02-23 Thread Tim Wintle
On Wed, 2011-02-23 at 13:57 +, Jorgen Grahn wrote: > If that's the *only* such use, I'd experiment with writing them as > sortable text to file, and run GNU sort (the Unix utility) on the file. > It seems to have a clever file-backed sort algorithm. +1 - and experiment with the different flags

Re: Creating Long Lists

2011-02-23 Thread Jorgen Grahn
On Tue, 2011-02-22, Ben Finney wrote: > Kelson Zawack writes: > >> I have a large (10gb) data file for which I want to parse each line >> into an object and then append this object to a list for sorting and >> further processing. > > What is the nature of the further processing? > > Does that furt

Re: Yappi error "context not found"

2011-02-23 Thread k3xji
On 10 Şubat, 08:38, Brian wrote: > I'm posting here because I can't find a Yappi specific mailing list. > > I've been using the rather brilliant Yappi fromhttp://code.google.com/p/yappi/ > It works well for small programs with a few threads. However, when > trying to run it over large programs wit

Re: Is setdefaultencoding bad?

2011-02-23 Thread Chris Rebert
On Wed, Feb 23, 2011 at 3:07 AM, moerchendiser2k3 wrote: > Ok, but that the interface handles UTF-8 strings > are still ok? The defaultencoding is still ascii. Yes, that's fine. UTF-8 is an excellent encoding choice, and encoding/decoding should always be done explicitly in Python, so the "defaul

Re: subprocess pipe question

2011-02-23 Thread Rita
This is a good solution thanks. You should wiki this somewhere. For extra points is there a way to speed up the p.stdout.read(bufsize) ? On Tue, Feb 22, 2011 at 7:57 PM, Rob Williscroft wrote: > Rita wrote in > news:AANLkTi=w95gxosc1tkt2bntgjqys1cbmdnojhokq4...@mail.gmail.com in > gmane.comp.

Re: How to use Python well?

2011-02-23 Thread Ben Finney
Anssi Saari writes: > Grant Edwards writes: > > > I've lost track of how many times I've tried to learn to use the Gnu > > "info" command and gave up in frustration. I've never seen a program > > with a more difficult to use UI. > > As I recall, there are other info viewers like tkinfo for examp

Re: Is setdefaultencoding bad?

2011-02-23 Thread moerchendiser2k3
Ok, but that the interface handles UTF-8 strings are still ok? The defaultencoding is still ascii. -- http://mail.python.org/mailman/listinfo/python-list

Re: Accelerating For Loop

2011-02-23 Thread Peter Otten
Şansal Birbaş wrote: > for i in range(1,5): > for j in i*range(max_expander+1): > for k in i*range(max_expander+1): > for m in i*range(max_expander+1): > for r in i*range(max_expander+1): I must be missing something, but I can't see why

2to3 chokes on bad character

2011-02-23 Thread Frank Millman
Hi all I don't know if this counts as a bug in 2to3.py, but when I ran it on my program directory it crashed, with a traceback but without any indication of which file caused the problem. Here is the traceback - Traceback (most recent call last): File "C:\Python32\Tools\Scripts\2to3.py", li

Re: How to use Python well?

2011-02-23 Thread Anssi Saari
Grant Edwards writes: > I've lost track of how many times I've tried to learn to use the Gnu > "info" command and gave up in frustration. I've never seen a program > with a more difficult to use UI. As I recall, there are other info viewers like tkinfo for example. But really, how hard is the

Re: Accelerating For Loop

2011-02-23 Thread Stefan Behnel
Şansal Birbaş, 23.02.2011 07:34: I needed to find the cheapest combination among given data and I developed an algorithm for this task. It works correctly. But it takes much time (nearly 2 minutes) for second function to find the result while it is just one second for the first function. How ca