len() should always return something

2009-07-23 Thread Dr. Phillip M. Feldman
Some aspects of the Python design are remarkably clever, while others leave me perplexed. Here's an example of the latter: Why does len() give an error when applied to an int or float? len() should always return something; in particular, when applied to a scalar, it should return a value of 1. Of

Registering DLL

2009-07-23 Thread Girish
Hello, I am facing a problem while registering DLL(Dspace.dll).. I am getting an error saying: "DLLRegisterServer inDspace.dll Failed. Return Code: 0x80040201" I am using following piece of code to generate DLL: # This setup script builds

Re: integer square roots

2009-07-23 Thread timro21
Bloody 'ell - thanks. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Issue combining gzip and subprocess

2009-07-23 Thread Scott David Daniels
Piet van Oostrum wrote: Scott David Daniels (SDD) schreef: ... SDD> Or even: SDD> proc = subprocess.Popen(['ls','-la'], stdout=subprocess.PIPE) SDD> with gzip.open(filename, 'w') as dest: SDD> for line in iter(proc.stdout, ''): SDD> f.write(line) If it would work.

Re: integer square roots

2009-07-23 Thread casevh
On Jul 23, 9:43 pm, timro21 wrote: > Hi Tim, sure, I'm looking at the perfect cuboid problem. > > I've just spent a couple of very frustrating hours.  Given that I'm in > my 50's but have the brain of a retarded 3-year-old, can someone > please explain what I have to do to download gmpy to use wit

Re: OverflowError in RLock.acquire()

2009-07-23 Thread David Roberts
I forgot to mention, Python version is 2.6.2. -- David Roberts http://da.vidr.cc/ On Fri, Jul 24, 2009 at 14:27, David Roberts wrote: > Hi, > > I'm trying to port a Python application to Windows, and I'm getting > the following error (which did not occur when running on Linux): > > Exception in

Re: integer square roots

2009-07-23 Thread timro21
Hi Tim, sure, I'm looking at the perfect cuboid problem. I've just spent a couple of very frustrating hours. Given that I'm in my 50's but have the brain of a retarded 3-year-old, can someone please explain what I have to do to download gmpy to use with ActivePython 2.6 on a Windows system? I do

OverflowError in RLock.acquire()

2009-07-23 Thread David Roberts
Hi, I'm trying to port a Python application to Windows, and I'm getting the following error (which did not occur when running on Linux): Exception in thread Thread-4: Traceback (most recent call last): File "C:\Python26\lib\threading.py", line 525, in __bootstrap_inner self.run() File "C:

Re: regex: multiple matching for one string

2009-07-23 Thread rurpy
Nick Dumas wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Agreed. Two string.split()s, first at the semi-colon and then at the > equal sign, will yield you your value, without having to fool around > with regexes. > > On 7/23/2009 9:23 AM, Mark Lawrence wrote: >> scriptlear...@gmail.c

Re: integer square roots

2009-07-23 Thread Tim Daneliuk
timro21 wrote: > Thanks to all! > > Tim While we're at it, would you mind saying more about what exactly you're doing - Inquiring Math Dorks (tm) want to know ... -- Tim Daneliuk tun...@tundraware.com PGP Key:

Re: extract c/cpp include file with regular expression

2009-07-23 Thread tiefeng wu
Thanks, Philip Semanchuk and Nick Craig-Wood! My goal is gather informations from cpp sources and generate cross referenced html files (as more detail as fine) So I think " missing some unusual cases" might be acceptable, but informations you introduced make me more interests to dig things out :) I

Re: If Scheme is so good why MIT drops it?

2009-07-23 Thread Carl Banks
On Jul 23, 5:52 pm, Rui Maciel wrote: > fft1976 wrote: > > How do you explain that something as inferior as Python beat Lisp in > > the market place despite starting 40 years later. > > Probably due to similar reasons that lead php to become remotely relevant. Well, the only reason PHP became rel

Re: If Scheme is so good why MIT drops it?

2009-07-23 Thread Carl Banks
On Jul 23, 4:57 pm, Paul Rubin wrote: > Carl Banks writes: > > > I don't think the concept of "drivers" applies to user-mode programs. > > > For FFI calls you would use an OS thread. > > That's contrary to the hypothesis, isn't it? > > Yeah, it would have been better

Re: What is file.encoding convention?

2009-07-23 Thread Naoki INADA
> > Yes! I confused by it. s/I confused/I am confused/ > "Writing unicode to a file(-like)" is a simple requirement. > Does python have any simple resolution for it? s/resolution/solution/ Sorry about my poor English. -- http://mail.python.org/mailman/listinfo/python-list

Re: integer square roots

2009-07-23 Thread Paul Rubin
casevh writes: > gmpy.is_square() is quite fast. On a older 32-bit Linux box, it can > test approximately 400,000 100-digits numbers per second. The time > includes conversion from a string. If the numbers are already Python > longs, it can check 800,000 per second. Checking a billion is not > unr

Re: integer square roots

2009-07-23 Thread casevh
> comp.lang.python is a good place to get answers about Python.  It's > probably not such a good source of answers about computational number > theory.  Also, Python is more about productivity than speed, so > answers involving Python may not be the most efficient possible > answers.  One obvious p

Re: integer square roots

2009-07-23 Thread Paul Rubin
timro21 writes: > Homework? Gosh no. I have several number theory applications which > need to know (quickly) whether particular very large numbers are > perfect squares. Since I asked this in this newsgroup I guess I > assumed that responses wuld relate specifically to how to do this > efficie

Re: If Scheme is so good why MIT drops it?

2009-07-23 Thread Rui Maciel
fft1976 wrote: > How do you explain that something as inferior as Python beat Lisp in > the market place despite starting 40 years later. Probably due to similar reasons that lead php to become remotely relevant. Rui Maciel -- http://mail.python.org/mailman/listinfo/python-list

Re: sqlite3 performance problems only in python

2009-07-23 Thread David Stanek
On Thu, Jul 23, 2009 at 6:29 PM, Stef Mientki wrote: > > but because the same SQL-statement in Delphi performed well, > I thought it was a problem with the Python implementation. Same SQL, but were you also using Sqlite in Delphi? -- David blog: http://www.traceback.org twitter: http://twitter.c

Re: integer square roots

2009-07-23 Thread timro21
On Jul 24, 10:35 am, Paul Rubin wrote: > timro21 writes: > > I wish to process billions of 100-digit numbers and test if each has > > an integer square root.  What's the most efficient way to do this? > > Is this a homework problem?  If not, may I ask what the applic

Re: What is file.encoding convention?

2009-07-23 Thread Naoki INADA
> What is the encoding of sys.stderr in your example? Sorry, I missed. It is cp932 > So the problem is essentially this: if a stream has an encoding > attribute, sometimes it is a wrapped stream which encodes Unicode > (e.g. a stream obtained via the codecs module) and sometimes it is not > (e.g.

Re: integer square roots

2009-07-23 Thread Paul Rubin
timro21 writes: > I wish to process billions of 100-digit numbers and test if each has > an integer square root. What's the most efficient way to do this? Is this a homework problem? If not, may I ask what the application is? I think the basic answer is 1) use the law of quadratic reciprocity

Re: integer square roots

2009-07-23 Thread Mensanator
On Jul 23, 7:17 pm, Mensanator wrote: > On Jul 23, 7:11 pm, Mensanator wrote: > > > > > > > On Jul 23, 6:02 pm, timro21 wrote: > > > > I wish to process billions of 100-digit numbers and test if each has > > > an integer square root.  What's the most efficient way to do this? > > > Use gmpy. > >

Re: invoke method on many instances

2009-07-23 Thread Aahz
In article , Gabriel Genellina wrote: > >NLMPI What? -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "At Resolver we've found it useful to short-circuit any doubt and just refer to comments in code as 'lies'. :-)" --Michael Foord paraphrases Christian Mu

Re: Help understanding the decisions *behind* python?

2009-07-23 Thread Aahz
In article , Mark Lawrence wrote: > >Sorry if this has been discussed and I've missed it, but how about >memory allocation. An immutable tuple has a fixed memory allocation >whereas that for the mutable list must be liable to change. You might >like to look at the recent thread on this ng 'L

Re: integer square roots

2009-07-23 Thread Mensanator
On Jul 23, 7:11 pm, Mensanator wrote: > On Jul 23, 6:02 pm, timro21 wrote: > > > I wish to process billions of 100-digit numbers and test if each has > > an integer square root.  What's the most efficient way to do this? > > Use gmpy. > > >>> import gmpy > >>> help(gmpy.sqrt) > > Help on built-in

Re: integer square roots

2009-07-23 Thread Mensanator
On Jul 23, 6:02 pm, timro21 wrote: > I wish to process billions of 100-digit numbers and test if each has > an integer square root.  What's the most efficient way to do this? Use gmpy. >>> import gmpy >>> help(gmpy.sqrt) Help on built-in function sqrt in module gmpy: sqrt(...) sqrt(x): ret

Re: If Scheme is so good why MIT drops it?

2009-07-23 Thread Paul Rubin
Carl Banks writes: > > I don't think the concept of "drivers" applies to user-mode programs. > > For FFI calls you would use an OS thread. > That's contrary to the hypothesis, isn't it? Yeah, it would have been better to say, green threads are ok for most typical forms of i/o concurrency, but OS

Re: Override a method but inherit the docstring

2009-07-23 Thread Shai
On Jul 17, 10:52 am, Steven D'Aprano wrote: > > When the decorator is called, the function object is just a function > object, not a method, so there is no concept of "what class it is > destined for". > ... which points to the better solution: use a descriptor. With the doc_inherit decorator def

Re: Bridging Python and C

2009-07-23 Thread Dave Angel
Mohan Parthasarathy wrote: Hi, I am a newbie. It looks like there are quite a few ways to bridge Python and C. I have a bunch of C code and I just need Python wrappers for it. If i google for this I get SWIG, Boost etc. And I also see http://www.python.org/doc/2.5.2/ext/intro.html What is the r

passing data to a liburl2 opener object

2009-07-23 Thread scriptlear...@gmail.com
I have prepared my headers and data for a HTTP POST message; however, I am not sure how to pass the data to the opener. Can you guys provide some suggestions? Thanks. proxy_handler = urllib2.ProxyHandler({'http': 'http://my.proxy.com: 3128/'}) opener = urllib2.build_opener(proxy_handler) url =

Re: If Scheme is so good why MIT drops it?

2009-07-23 Thread Carl Banks
On Jul 22, 5:27 pm, Paul Rubin wrote: > Carl Banks writes: > > I don't think your fantasy async-only all-green-thread langauge > > implementation is possible anyway. > > Erlang and GHC both work like that, quite successfully: > >  http://shootout.alioth.debian.org/gp

Re: Detect target name in descriptor __set__ method

2009-07-23 Thread Gabriel Genellina
En Thu, 23 Jul 2009 10:19:33 -0300, DG escribió: On Jul 22, 6:05 pm, "Gabriel Genellina" wrote: En Wed, 22 Jul 2009 11:01:09 -0300, Rhodri James   escribió: > On Wed, 22 Jul 2009 06:02:55 +0100, Gabriel Genellina   > wrote: >> class X(object): >>    foo = descriptor() >> x = X() >> x.foo

Re: win32clipboard operation

2009-07-23 Thread MRAB
LeeRisq wrote: On Jul 23, 9:05 am, MRAB wrote: LeeRisq wrote: Hi all, Newbie question. I've written a script that outputs to a text file. Now, I just want to copy the content to win32clipboard for access to other applications. Here's the mess I've come up with so far:) [snip] def copy_text()

Re: strange python scripting error

2009-07-23 Thread Dave Angel
Mark Tarver wrote: I have a very strange error. I have two test python files test.py and python.py which contain the following code #!/usr/bin/python print "Content-type: text/html" print print "" print "Hello, Linux.com!" print "" One file (test.py) works; you call it up and it shows a web pa

Re: Pyserial and pyQt

2009-07-23 Thread David Boddie
On Thursday 23 July 2009 10:13, Dennis Lee Bieber wrote: > On Wed, 22 Jul 2009 10:32:51 -0700 (PDT), Seth > declaimed the following in gmane.comp.python.general: > >> Thanks for the response. I have gone through a lot of the tutorials. >> All of them(that I saw) seem to just deal will event-bas

Re: strange python scripting error

2009-07-23 Thread Peter Otten
Mark Tarver wrote: > On 23 July, 18:01, Dennis Lee Bieber wrote: >> On Thu, 23 Jul 2009 08:48:46 -0700 (PDT), Mark Tarver >> declaimed the following in >> gmane.comp.python.general: >> >> > The only hint at a difference I can see is that my ftp program says >> > the files are of unequal lengths.

Re: sqlite3 performance problems only in python

2009-07-23 Thread Christian Heimes
Stef Mientki schrieb: > hello, > > until now I used only small / simple databases in Python with sqlite3. > Now I've a large and rather complex database. > > The most simple query (with just a result of 100 rows), > takes about 70 seconds. > And all that time is consumed in "cursor.fetchall" > >

Re: If Scheme is so good why MIT drops it?

2009-07-23 Thread Carl Banks
On Jul 23, 2:37 am, Nobody wrote: > On Wed, 22 Jul 2009 15:17:52 -0700, Carl Banks wrote: > > So do all these OSes have some kind of __mega_unifying_poll system > > call that works for anything that might possibly block, that you can > > exploit from a user process? > > Threads ;) Yeah, well that

Re: strange python scripting error

2009-07-23 Thread Mark Tarver
On 23 July, 18:01, Dennis Lee Bieber wrote: > On Thu, 23 Jul 2009 08:48:46 -0700 (PDT), Mark Tarver > declaimed the following in > gmane.comp.python.general: > > > The only hint at a difference I can see is that my ftp program says > > the files are of unequal lengths.  test.py is 129 bytes long.

Re: sqlite3 performance problems only in python

2009-07-23 Thread Stef Mientki
Che M wrote: On Jul 23, 3:58 pm, Stef Mientki wrote: Piet van Oostrum wrote: Stef Mientki (SM) wrote: SM> btw, I don't know if it's of any importance, the SQL-statement I perform is SM> select OPNAMEN.*, NAME, NAME_, SCORES.SCORE, PATIENT.* SM> from OPNAMEN SM>i

Re: strange python scripting error

2009-07-23 Thread Mark Tarver
On 23 July, 18:01, Dennis Lee Bieber wrote: > On Thu, 23 Jul 2009 08:48:46 -0700 (PDT), Mark Tarver > declaimed the following in > gmane.comp.python.general: > > > I have a very strange error.  I have two test python files test.py and > > python.py which contain the following code > >         >

Gedcom and Genealogy

2009-07-23 Thread Gordon
We have many small libraries in JAVA or Ruby that need to be ported to Python. Actually it's so simple a rewrite is possible too. -- http://mail.python.org/mailman/listinfo/python-list

Re: If Scheme is so good why MIT drops it?

2009-07-23 Thread Paul Rubin
Nobody writes: > They also have the advantage that one thread can run while another is > waiting on disk I/O, which isn't something which can be done with a > select/poll interface (even if select/poll worked for files, it doesn't > help for mapped files). AIO can help with this, but I don't know

netCDF4 usage issues

2009-07-23 Thread Nathan
I am having issues correctly implementing the multi-file read functionality in the Python module netCDF4 (whitaker - http://code.google.com/p/netcdf4-python/). I am a relative beginner to Python, so I may be missing something simple. I've done my best to follow the example in the documentation at

Re: Looking for os.listdir() generator

2009-07-23 Thread Christian Heimes
Nick Craig-Wood wrote: > Christian Heimes wrote: >> I'm looking for a generator version of os.listdir() for Python 2.5 and >> newer. I know somebody has worked on it because I've seen a generator >> version in a posting on some list or blog a while ago. I can't find it >> anymore. It seems my

Re: sqlite3 performance problems only in python

2009-07-23 Thread Che M
On Jul 23, 3:58 pm, Stef Mientki wrote: > Piet van Oostrum wrote: > >> Stef Mientki (SM) wrote: > > >> SM> btw, I don't know if it's of any importance, the SQL-statement I > >> perform is > >> SM> select OPNAMEN.*, NAME, NAME_, SCORES.SCORE, PATIENT.* > >> SM>  from OPNAMEN > >> SM>    inner

Re: Bridging Python and C

2009-07-23 Thread Philip Semanchuk
On Jul 23, 2009, at 5:45 PM, Mohan Parthasarathy wrote: Hi, I am a newbie. It looks like there are quite a few ways to bridge Python and C. I have a bunch of C code and I just need Python wrappers for it. If i google for this I get SWIG, Boost etc. And I also see http://www.python.org/doc

Re: Bridging Python and C

2009-07-23 Thread Christian Heimes
Mohan Parthasarathy wrote: > Hi, > I am a newbie. It looks like there are quite a few ways to bridge Python and > C. I have a bunch of C code and I just need Python wrappers for it. If i > google for this I get SWIG, Boost etc. And I also see > > http://www.python.org/doc/2.5.2/ext/intro.html > >

Bridging Python and C

2009-07-23 Thread Mohan Parthasarathy
Hi, I am a newbie. It looks like there are quite a few ways to bridge Python and C. I have a bunch of C code and I just need Python wrappers for it. If i google for this I get SWIG, Boost etc. And I also see http://www.python.org/doc/2.5.2/ext/intro.html What is the recommended way for doing this

Re: Creating xml

2009-07-23 Thread Gerhard Häring
Greg Lindstrom wrote: > It's been a while since I've played with XML using Python but I've been > asked to create XML using data from our postgres database. Currently we > are generating XML directly from the database using a set of stored > procedures but it is too slow (yes, I have numbers). I

Re: Problems in commands.getoutput(cmd) with sox

2009-07-23 Thread MRAB
bbarb...@inescporto.pt wrote: Hello to all! I am a new researcher, new to Python as well, and I have a problem, when I try to get commands from sox in a python script. I am going crazy, because this code has been working before.. so I dont really know whats going on.. Ive already seen some

Re: Problems in commands.getoutput(cmd) with sox

2009-07-23 Thread Peter Otten
bbarb...@inescporto.pt wrote: > Hello to all! > > I am a new researcher, new to Python as well, and I have a problem, > when I try to get commands from sox in a python script. I am going > crazy, because this code has been working before.. so I dont really > know whats going on.. > > Ive already

Re: 2.3 missing on OSX

2009-07-23 Thread Ned Deily
In article , Laran Evans wrote: > I just tried to run MacVim on OSX 10.5. It crashed with this: > > Dyld Error Message: > Library not loaded: /System/Library/Frameworks/Python.framework/ > Versions/2.3/Python > Referenced from: /Users/laran/Downloads/MacVim-7_2-stable-1_2/ > MacVim.app/Cont

Re: 2.3 missing on OSX

2009-07-23 Thread Philip Semanchuk
On Jul 23, 2009, at 5:01 PM, Diez B. Roggisch wrote: Laran Evans schrieb: I just tried to run MacVim on OSX 10.5. It crashed with this: Dyld Error Message: Library not loaded: /System/Library/Frameworks/Python.framework/ Versions/2.3/Python Referenced from: /Users/laran/Downloads/MacVim-7_2-

Re: 2.3 missing on OSX

2009-07-23 Thread Diez B. Roggisch
Laran Evans schrieb: I just tried to run MacVim on OSX 10.5. It crashed with this: Dyld Error Message: Library not loaded: /System/Library/Frameworks/Python.framework/ Versions/2.3/Python Referenced from: /Users/laran/Downloads/MacVim-7_2-stable-1_2/ MacVim.app/Contents/MacOS/Vim Reason: i

Re: 2.3 missing on OSX

2009-07-23 Thread Philip Semanchuk
On Jul 23, 2009, at 4:53 PM, Laran Evans wrote: I just tried to run MacVim on OSX 10.5. It crashed with this: Dyld Error Message: Library not loaded: /System/Library/Frameworks/Python.framework/ Versions/2.3/Python Referenced from: /Users/laran/Downloads/MacVim-7_2-stable-1_2/ MacVim.app/Con

2.3 missing on OSX

2009-07-23 Thread Laran Evans
I just tried to run MacVim on OSX 10.5. It crashed with this: Dyld Error Message: Library not loaded: /System/Library/Frameworks/Python.framework/ Versions/2.3/Python Referenced from: /Users/laran/Downloads/MacVim-7_2-stable-1_2/ MacVim.app/Contents/MacOS/Vim Reason: image not found I poste

Re: sqlite3 performance problems only in python

2009-07-23 Thread Jerry Hill
On Thu, Jul 23, 2009 at 4:29 PM, Nick Craig-Wood wrote: > In all the databases I've used, the like operator has been case > insensitive, so if that is the problem you could use This is not true in all databases!  Many times, this is something that is configurable when setting up the database serve

Re: If Scheme is so good why MIT drops it?

2009-07-23 Thread Jon Harrop
Raffael Cavallaro wrote: > Yes, you are missing the joke. The point is that if python is 60x > slower than C, even if there were not a GIL, it would require running > the python program on a 60 core machine just reach parity with C. The > existence of the GIL means that in reality you'd probably ne

Re: Looking for os.listdir() generator

2009-07-23 Thread Nick Craig-Wood
Christian Heimes wrote: > I'm looking for a generator version of os.listdir() for Python 2.5 and > newer. I know somebody has worked on it because I've seen a generator > version in a posting on some list or blog a while ago. I can't find it > anymore. It seems my Google fu is lacking today. A

Re: Pep 342 (val = yield MyGenerator(foo)), synchronous os.system() that doesn't block gui event loops

2009-07-23 Thread Nick Craig-Wood
Ville Vainio wrote: > Has anyone implementing something like what the subject line > indicates? > > The idea: > > To run functions that execute a series of system commands without > blocking the ui, *and* without adding state machine logic. > > The syntax would be something like: > > de

Re: sqlite3 performance problems only in python

2009-07-23 Thread Nick Craig-Wood
David Stanek wrote: > On Thu, Jul 23, 2009 at 9:02 AM, Stef Mientki wrote: > > > > btw, I don't know if it's of any importance, the SQL-statement I perform is > > select OPNAMEN.*, NAME, NAME_, SCORES.SCORE, PATIENT.* > >  from OPNAMEN > >   inner join POID_VLID          on OPNAMEN.POID          

Re: installing 2.6 on vista64

2009-07-23 Thread Jaime Fernandez del Rio
I have installed the 32 bit 2.6 and the 64 bit 3.1 on my machine running Vista 64 without any issues. Which of course has nothing to do with your problem On Thu, Jul 23, 2009 at 7:06 PM, DwBear75 wrote: > I just downloaded and attempted to install python 2.6.2.  The > installer proceeds to do

Re: sqlite3 performance problems only in python

2009-07-23 Thread Stef Mientki
David Stanek wrote: On Thu, Jul 23, 2009 at 9:02 AM, Stef Mientki wrote: btw, I don't know if it's of any importance, the SQL-statement I perform is select OPNAMEN.*, NAME, NAME_, SCORES.SCORE, PATIENT.* from OPNAMEN inner join POID_VLID on OPNAMEN.POID= POID_VLID.POID

Re: sqlite3 performance problems only in python

2009-07-23 Thread Stef Mientki
Piet van Oostrum wrote: Stef Mientki (SM) wrote: SM> btw, I don't know if it's of any importance, the SQL-statement I perform is SM> select OPNAMEN.*, NAME, NAME_, SCORES.SCORE, PATIENT.* SM> from OPNAMEN SM>inner join POID_VLID on OPNAMEN.POID= POID_

effbot.org broken (WAS: Problems in commands.getoutput(cmd) with sox)

2009-07-23 Thread Chris Rebert
On Thu, Jul 23, 2009 at 12:42 PM, Chris Rebert wrote: > You can use tabnanny to help diagnose the problem: > http://74.125.155.132/search?q=cache:QtxvZm3QDLsJ:effbot.org/librarybook/tabnanny.htm+tabnanny&cd=3&hl=en&ct=clnk&gl=us&client=firefox-a Anyone know what's the deal with effbot.org? It seem

Re: What is file.encoding convention?

2009-07-23 Thread Vinay Sajip
On Jul 23, 4:06 am, Naoki INADA wrote: > In document stdtypes.html#file.encoding>: > > >> The encoding that this file uses. When Unicode strings are written to a > >> file, > >> they will be converted to byte strings using this encoding. In addition, > >> when

Re: Looking for os.listdir() generator

2009-07-23 Thread Piet van Oostrum
> Christian Heimes (CH) wrote: >CH> Hello, >CH> I'm looking for a generator version of os.listdir() for Python 2.5 and >CH> newer. I know somebody has worked on it because I've seen a generator >CH> version in a posting on some list or blog a while ago. I can't find it >CH> anymore. It seems

Re: win32clipboard operation

2009-07-23 Thread LeeRisq
> I've actually tried this configuration, but I did it again just to be > sure. The program executes without exception, but the text still isn't > copied to the clipboard. Any ideas? So, I think I've figured out the issue. Which brings me to another question...why is it that I can manually copy an

Re: extract c/cpp include file with regular expression

2009-07-23 Thread Nick Craig-Wood
tiefeng wu wrote: > I need to parse c/cpp source files, one requirement is to extract > included header file name. If you are serious about parsing C code then you'll want to investigate gcc-xml http://www.gccxml.org/HTML/Index.html This runs the gcc frontend over the code but instead of prod

Re: Creating xml

2009-07-23 Thread Chris Rebert
On Thu, Jul 23, 2009 at 12:30 PM, Greg Lindstrom wrote: > How about if I need/want to parse or process an XML file? xml.etree.ElementTree in the standard library: http://docs.python.org/library/xml.etree.elementtree.html Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailm

Problems in commands.getoutput(cmd) with sox

2009-07-23 Thread bbarbero
Hello to all! I am a new researcher, new to Python as well, and I have a problem, when I try to get commands from sox in a python script. I am going crazy, because this code has been working before.. so I dont really know whats going on.. Ive already seen some solutions that match with wh

Creating xml

2009-07-23 Thread Greg Lindstrom
It's been a while since I've played with XML using Python but I've been asked to create XML using data from our postgres database. Currently we are generating XML directly from the database using a set of stored procedures but it is too slow (yes, I have numbers). I have been asked to create a ro

Re: If Scheme is so good why MIT drops it?

2009-07-23 Thread Paul Donnelly
game_designer writes: > Perhaps like Xah Lee I find, after many years of Lisp programming, > these discussions increasingly frustrating and even, in some sense, > amazing. We can speculate all we want about syntax and semantics of > programing languages. What counts in the end are really the PRAG

Re: sqlite3 performance problems only in python

2009-07-23 Thread Piet van Oostrum
> Stef Mientki (SM) wrote: >SM> btw, I don't know if it's of any importance, the SQL-statement I perform is >SM> select OPNAMEN.*, NAME, NAME_, SCORES.SCORE, PATIENT.* >SM> from OPNAMEN >SM>inner join POID_VLID on OPNAMEN.POID= >POID_VLID.POID >SM>inner join VRA

Re: If Scheme is so good why MIT drops it?

2009-07-23 Thread game_designer
Perhaps like Xah Lee I find, after many years of Lisp programming, these discussions increasingly frustrating and even, in some sense, amazing. We can speculate all we want about syntax and semantics of programing languages. What counts in the end are really the PRAGMATICS of programming languages.

Re: challenging problem for changing to a dedicated non-privileged user within a script.

2009-07-23 Thread Piet van Oostrum
> Krishnakant (K) wrote: >K> On Thu, 2009-07-23 at 13:50 +0200, paul wrote: >>> If the user running python program is allowed to call setuid() then yes. >>> >K> NO, i don't think i can do that. I am getting opperation not permitted. >K> Any ways I think probably subprocess will have to sor

Re: Help understanding the decisions *behind* python?

2009-07-23 Thread Mark Lawrence
Phillip B Oldham wrote: My colleagues and I have been working with python for around 6 months now, and while we love a lot of what python has done for us and what it enables us to do some of the decisions behind such certain data-types and their related methods baffle us slightly (when compared t

Re: If Scheme is so good why MIT drops it?

2009-07-23 Thread Isaac Gouy
On Jul 21, 10:09 pm, Raffael Cavallaro wrote: > On 2009-07-21 19:06:02 -0400, Neil Hodgson > said: > > >    Python uses native threads. > > So it can be teh-slowness on all ur cores! > > > > The global interpreter lock doesn't

Re: import vs imp and friends.

2009-07-23 Thread Robert Kern
On 2009-07-23 09:44, Emanuele D'Arrigo wrote: Greetings, I was looking in the archive of this newsgroup and I found this snippet: import imp sourcecode = 'def foo(x): return 11*x' mod = imp.new_module('foo') exec sourcecode in mod.__dict__ mod.foo(16) Together with similar and sometimes more c

Re: win32clipboard operation

2009-07-23 Thread LeeRisq
On Jul 23, 9:05 am, MRAB wrote: > LeeRisq wrote: > > Hi all, > > > Newbie question. I've written a script that outputs to a text file. > > > Now, I just want to copy the content to win32clipboard for access to > > other applications. Here's the mess I've come up with so far:) > > [snip] > > def co

installing 2.6 on vista64

2009-07-23 Thread DwBear75
I just downloaded and attempted to install python 2.6.2. The installer proceeds to do its work then dies, leaving an entry in the eventlog: Windows Installer installed the product. Product Name: Python 2.6.2. Product Version: 2.6.2150. Product Language: 1033. Installation success or error status:

Re: ANN: psyco V2

2009-07-23 Thread Christian Tismer
On 7/17/09 4:11 AM, Bearophile wrote: Very good, thank you. I'll try it when I can. Is Psyco3 going to borrow/steal some ideas/code from Unladen Swallow? Psyco3: nice typo! :-) Well, I haven't so far found a new idea there that I'd want to borrow and did not know from PyPy, before. Wasn't the

Re: PyQt GUI

2009-07-23 Thread Robert Kern
On 2009-07-23 03:55, Helvin wrote: I believe I now have vtkpython.exe. However, my 'import vtk' statement in my python code is not working. The error says something like "no module named vtk". Where do I find modules for vtk in pyqt? Do they exist? There are no VTK modules in PyQt itself. The P

Re: extract c/cpp include file with regular expression

2009-07-23 Thread Philip Semanchuk
On Jul 23, 2009, at 12:36 PM, tiefeng wu wrote: 2009/7/24 Philip Semanchuk : I know this will sound like a sarcastic comment, but it is sincere: my suggestion is that if you want to parse C/C++ (or Python, or Perl, or Fortran, etc.), use a real parser, not regexes unless you're willing t

Re: Balanced binary tree implementation

2009-07-23 Thread M.-A. Lemburg
Lucas P Melo wrote: > Hello, > > I would like to use a balanced binary tree implementation (preferably > within some API). > Any hints about where I could find it? > > I am looking for something that implements insertion, deletion, search > and a special search that returns the lesser element big

Re: Changing the private variables content

2009-07-23 Thread Ethan Furman
Or, in other words, what Steven D'Aprano had already said. Guess I should read the whole thread before madly posting! :) ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: psyco V2

2009-07-23 Thread Christian Tismer
On 7/23/09 8:22 AM, Christian Heimes wrote: Christian Tismer wrote: Psyco V2 will run on X86 based 32 bit Linux, 32 bit Windows, and Mac OS X. Psyco is not supporting 64 bit, yet. But it is well being considered. Can you estimate how much work needs to be done in order to get Psyco working on

Re: extract c/cpp include file with regular expression

2009-07-23 Thread tiefeng wu
2009/7/24 Philip Semanchuk : > > I know this will sound like a sarcastic comment, but it is sincere: my > suggestion is that if you want to parse C/C++ (or Python, or Perl, or > Fortran, etc.), use a real parser, not regexes unless you're willing to > sacrifice some accuracy. Sooner or later you'll

Re: Detect target name in descriptor __set__ method

2009-07-23 Thread DG
On Jul 23, 8:44 am, Rainer Mansfeld wrote: > Gabriel Genellina schrieb: > > > I have a class attribute 'foo' which is a data descriptor. I create an > > instance of such class. When I say instance.foo = value, the descriptor > > __set__ method is called. Is there any way to obtain the name being >

Re: extract c/cpp include file with regular expression

2009-07-23 Thread tiefeng wu
MRAB wrote: > I'd probably do: > p = re.compile(r'#\s*include\s+(?:<([^>]*)>|"([^"]*)")') m = p.search('#include ') m.group(1) or m.group(2) > 'header.h' > yes, it's easier to understand. thanks, MRAB! I always make things complicated :P tiefeng wu 2009-07-23 -- http://mail.python

Re: strange python scripting error

2009-07-23 Thread Peter Otten
Diez B. Roggisch wrote: > Mark Tarver wrote: > >> I have a very strange error. I have two test python files test.py and >> python.py which contain the following code >> >> #!/usr/bin/python >> print "Content-type: text/html" >> print >> print "" >> print "Hello, Linux.com!" >> print "" >> >> O

Re: strange python scripting error

2009-07-23 Thread Richard Brodie
"Diez B. Roggisch" wrote in message news:7crfjof29e4g...@mid.uni-berlin.de... > They have different line-ending-conventions. Not sure if and why that makes > a difference. Depends on your setup. Shells can be a bit dumb about it, so it will likely break simple cgi-style hosting. -bash: ./pyth

Re: extract c/cpp include file with regular expression

2009-07-23 Thread MRAB
tiefeng wu wrote: Hi all! I need to parse c/cpp source files, one requirement is to extract included header file name. here is my solution: p = re.compile(r'#\s*include\s+(?:(<)|("))(.*)(?(1)>)(?(2)")') m = re.search(p, '#include ') m.group(3) 'header.h' m = re.search(p, '#include "header.h"')

Re: sqlite3 performance problems only in python

2009-07-23 Thread David Stanek
On Thu, Jul 23, 2009 at 9:02 AM, Stef Mientki wrote: > > btw, I don't know if it's of any importance, the SQL-statement I perform is > select OPNAMEN.*, NAME, NAME_, SCORES.SCORE, PATIENT.* >  from OPNAMEN >   inner join POID_VLID          on OPNAMEN.POID            = POID_VLID.POID >   inner join

Re: win32clipboard operation

2009-07-23 Thread MRAB
LeeRisq wrote: Hi all, Newbie question. I've written a script that outputs to a text file. Now, I just want to copy the content to win32clipboard for access to other applications. Here's the mess I've come up with so far:) [snip] def copy_text(): ifile = open(r"C:\Query\DQL.txt", "r")

Re: strange python scripting error

2009-07-23 Thread Diez B. Roggisch
Mark Tarver wrote: > I have a very strange error. I have two test python files test.py and > python.py which contain the following code > > #!/usr/bin/python > print "Content-type: text/html" > print > print "" > print "Hello, Linux.com!" > print "" > > One file (test.py) works; you call it up

Re: extract c/cpp include file with regular expression

2009-07-23 Thread Philip Semanchuk
On Jul 23, 2009, at 11:46 AM, tiefeng wu wrote: Hi all! I need to parse c/cpp source files, one requirement is to extract included header file name. here is my solution: p = re.compile(r'#\s*include\s+(?:(<)|("))(.*)(?(1)>)(?(2)")') m = re.search(p, '#include ') m.group(3) 'header.h' m = re.

Re: regex: multiple matching for one string

2009-07-23 Thread tiefeng wu
2009/7/23 scriptlear...@gmail.com : > For example, I have a string "#a=valuea;b=valueb;c=valuec;", and I > will like to take out the values (valuea, valueb, and valuec).  How do > I do that in Python?  The group method will only return the matched > part.  Thanks. > > p = re.compile('#a=*;b=*;c=*;'

  1   2   >