Re: binary literal

2009-07-23 Thread Hendrik van Rooyen
On Wednesday 22 July 2009 12:03:44 superpollo wrote: > can i do something like the above, but using a *binary* number? (e.g. > 00101101 instead of 45) ? 00101101 is not hex 45. hex 45 is 01000101 >>> chr(int('01000101',2)) 'E' >>> - Hendrik -- http://mail.python.org/mailman/listinfo/python-

[Unblocking VoIP in UAE] for freedom!

2009-07-23 Thread cindy
Please view this newsletter online at: http://www.mynewsletterbuilder.com/tools/view_newsletter.php?newsletter_id=1409985533 SpeedVoIP Communication Technology Co., LTD. - 600, 6th Avenue S.W. - Calgary - Alberta - T2P 0S5 Subscribe to this newsletter: https://www.mynewsletterbuilder.com/tools/sub

Re: Changing the private variables content

2009-07-23 Thread Ethan Furman
Ryniek90 wrote: Got it: exec('self.' + attr + '=\'' + val + '\'') That worked. I think it'll do what you want now ;) Ching-Yun "Xavier" Ho, Technical Artist Contact Information Mobile: (+61) 04 3335 4748 Skype ID: SpaXe85 Email: cont...@xavierho.com Website: htt

how two join and arrange two files together

2009-07-23 Thread amrita
Hi, I have two large files: FileA 15 ALA H = 8.05 N = 119.31 CA = 52.18 HA = 4.52 C = 21 ALA H = 7.66 N = 123.58 CA = 54.33 HA = C = 179.35 23 ALA H = 8.78 N = CA = HA = C = 179.93. and FileB 21 ALA helix (helix_alpha, helix2) 23 ALA helix (helix_alpha, helix3) 38 ALA heli

Re: Help understanding the decisions *behind* python?

2009-07-23 Thread Hendrik van Rooyen
On Wednesday 22 July 2009 16:36:51 Inky 788 wrote: > On Jul 22, 2:36 am, Hendrik van Rooyen > > wrote: > > The good reason is the immutability, which lets you use > > a tuple as a dict key.   > > Thanks for the reply Hendrik (and Steven (other reply)). Perhaps I'm > just not sophisticated enough,

Re: Ideas for problem with chat server application!

2009-07-23 Thread Martin P. Hellwig
David Adamo Jr. wrote: My attempt was to create a windows service that start automatically and runs this batch file using a Network Service account on the server system. Although, I'm having a hard time with this (temporarily), I would love to ask if there are any alternatives to using a windows

Re: how two join and arrange two files together

2009-07-23 Thread Chris Rebert
On Thu, Jul 23, 2009 at 12:22 AM, wrote: > > Hi, > > I have two large files: > > FileA > 15 ALA H = 8.05 N = 119.31 CA = 52.18 HA = 4.52 C = > 21 ALA H = 7.66 N = 123.58 CA = 54.33 HA = C = 179.35 > 23 ALA H = 8.78 N =  CA =  HA = C = 179.93. > > and > > FileB > 21 ALA  helix (heli

Re: comments? storing a function in an object

2009-07-23 Thread Carl Banks
On Jul 22, 8:38 pm, a...@pythoncraft.com (Aahz) wrote: > In article > , > Carl Banks   wrote: > > >You have to be REALLY REALLY careful not to pass any user-supplied > >data to it if this is a server running on your computer, of course. > > Unless, of course, your users are paying for this service

Re: PyQt GUI

2009-07-23 Thread Helvin
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? They must, right? Because there are people using vtk in pyqt? Or do I have to use Op

Re: How to document Python code properly for Pydoc

2009-07-23 Thread jorma kala
Thanks very much for your help On Wed, Jul 22, 2009 at 6:43 PM, Lie Ryan wrote: > jorma kala wrote: > > Hi, > > Do you know where I can find the rules for documenting Python code, so > > that automatic document generation with Pydoc makes the most of the > > comments inserted in the code? > > I

Re: binary literal

2009-07-23 Thread superpollo
Hendrik van Rooyen wrote: On Wednesday 22 July 2009 12:03:44 superpollo wrote: can i do something like the above, but using a *binary* number? (e.g. 00101101 instead of 45) ? 00101101 is not hex 45. hex 45 is 01000101 whoopsie daisie! chr(int('01000101',2)) 'E' much obliged. by

strange error when trying to log something

2009-07-23 Thread Ryszard Szopa
Hi, I've recently reinstalled Python 2.6 (from DMG) on my Mac, and I am running into very strage errors. Namely, logging seems to be badly broken. When I open the interpreter through Django's manage.py shell and try to use logging, I get the following error: >>> logging.critical('ala') --

Re: What is file.encoding convention?

2009-07-23 Thread Naoki INADA
> What is file.encoding convention? > If I want to write a unicode string to a file(-like) that have > encoding attribute, I should do > (1) try: file.write(unicode_str), > (2) except UnicodeEncodeError: file.write(unicode_str.encode > (file.encoding)) > like logging? > It seems agly. s/agly/ugly/

Re: strange error when trying to log something

2009-07-23 Thread Peter Otten
Ryszard Szopa wrote: > Hi, > > I've recently reinstalled Python 2.6 (from DMG) on my Mac, and I am > running into very strage errors. Namely, logging seems to be badly > broken. When I open the interpreter through Django's manage.py shell > and try to use logging, I get the following error: > >>

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

2009-07-23 Thread Nobody
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 ;) They also have the advantage that one thread can run while a

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

2009-07-23 Thread Krishnakant
On Thu, 2009-07-23 at 00:17 +0200, Piet van Oostrum wrote: > Being a sudoer is not a privilege to issue the os.setuid system call. It > is only a permission to use the sudo command. > Yes, So I would like to know if python can change the user to some other non-privileged user during the script exe

available formats and params for Image.save()

2009-07-23 Thread News123
Hi, Somehow I have difficulties reading the documentation for PIL (Image) Is there an easy way to know which formats are supported and what their names are? Is there an easy way to know which parameters are supported by Image.save(). How can I list them where are they documented? Somehow I con

Re: Multiple versions of python

2009-07-23 Thread Nobody
On Tue, 21 Jul 2009 10:19:42 -0400, Dave Angel wrote: > The other thing you may want to do in a batch file is to change the file > associations so that you can run the .py file directly, without typing > "python" or "pythonw" in front of it. > > The relevant Windows commands are: assoc and

raster (PIL)

2009-07-23 Thread superpollo
hi. i wrote a program which transforms a string of zeroes ando ones into a png file. #!/usr/bin/env python import Image import sys bits_in_a_byte = 8 raster_string = """\ 0010010000101000 00100100101010100100 0000111000101000

Re: Help understanding the decisions *behind* python?

2009-07-23 Thread Tim Rowe
2009/7/22 Inky 788 : > Thanks for the reply Hendrik (and Steven (other reply)). Perhaps I'm > just not sophisticated enough, but I've never wanted to use a list/ > tuple as a dict key. This sounds like obscure usage, and a bit > contrived as a reason for having *both* lists and tuples. If you are

Re: ANN: Shed Skin 0.2, an experimental (restricted) Python-to-C++ compiler

2009-07-23 Thread Nick Craig-Wood
srepmub wrote: > please send any program that doesn't work with shedskin (it still is > experimental after all) to me, or create an issue at > shedskin.googlecode.com, and I will have a look at the problem. I divided and conquered the program as suggested and eventually I got it to compile and

sqlite3 performance problems only in python

2009-07-23 Thread Stef Mientki
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" Using the same database in Delphi, using

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

2009-07-23 Thread paul
Krishnakant schrieb: On Thu, 2009-07-23 at 00:17 +0200, Piet van Oostrum wrote: Being a sudoer is not a privilege to issue the os.setuid system call. It is only a permission to use the sudo command. Yes, So I would like to know if python can change the user to some other non-privileged user du

Re: raster (PIL)

2009-07-23 Thread Diez B. Roggisch
superpollo wrote: > hi. > > i wrote a program which transforms a string of zeroes ando ones into a > png file. > > #!/usr/bin/env python > import Image > import sys > bits_in_a_byte = 8 > raster_string = """\ > > 0010010000101000 > 00100100101

Re: Copy/paste through LAN

2009-07-23 Thread Piet van Oostrum
> Jun (J) wrote: >J> Hello, >J> I've a client/server application which uses Pyro to communicate each >J> other. >J> Now i try to implement copy/paste through LAN between server >J> controlled >J> filesystem to my local windows machine (I could list files in client's >J> window). >J> How can i

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 00:17 +0200, Piet van Oostrum wrote: >>> Being a sudoer is not a privilege to issue the os.setuid system call. It >>> is only a permission to use the sudo command. >>> >K> Yes, So I would like to know if python can change the user to some ot

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

2009-07-23 Thread Krishnakant
On Thu, 2009-07-23 at 13:50 +0200, paul wrote: > If the user running python program is allowed to call setuid() then yes. > NO, i don't think i can do that. I am getting opperation not permitted. Any ways I think probably subprocess will have to sort it out. > Did you try running "sudo -u post

Re: how two join and arrange two files together

2009-07-23 Thread Jyoti Sharma
On Thu, 23 Jul 2009 12:52:15 +0530, wrote: Hi, I have two large files: FileA 15 ALA H = 8.05 N = 119.31 CA = 52.18 HA = 4.52 C = 21 ALA H = 7.66 N = 123.58 CA = 54.33 HA = C = 179.35 23 ALA H = 8.78 N = CA = HA = C = 179.93. and FileB 21 ALA helix (helix_alpha, helix2) 2

Looking for os.listdir() generator

2009-07-23 Thread Christian Heimes
Hello, 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. All I can find is a very old v

Re: sqlite3 performance problems only in python

2009-07-23 Thread Tim Chase
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" Using the same database in Delphi, using the sam

Re: raster (PIL)

2009-07-23 Thread Peter Otten
superpollo wrote: > i wrote a program which transforms a string of zeroes ando ones into a > png file. > > #!/usr/bin/env python > import Image > import sys > bits_in_a_byte = 8 > raster_string = """\ > > 0010010000101000 > 0010010010101000

Re: raster (PIL)

2009-07-23 Thread superpollo
Diez B. Roggisch wrote: superpollo wrote: ... high = len(raster_lines) wide = len(raster_lines[0]) bytes_in_a_row = wide/bits_in_a_byte This will give you the wrong result if not divideable by bits_in_a_byte. then maybe: #!/usr/bin/env python import Image import sys bits_in_a_byte = 8 r

Re: python function for retrieving key and encryption

2009-07-23 Thread Piet van Oostrum
> jayshree (j) wrote: >j> On Jul 21, 8:59 pm, Piet van Oostrum wrote: >>> The recipient_public_key.pem file is the public key of the recipient >>> which means the person that is going to receive the encrypted message. >>> You should get it from the recipient him/herself or from some key sto

Re: raster (PIL)

2009-07-23 Thread superpollo
Peter Otten wrote: superpollo wrote: i wrote a program which transforms a string of zeroes ando ones into a png file. ... any suggestions for improvement? ... Here's a different approach: ... The idea is to move the bit-twiddling from python to code written in C, pointless for such a tin

Re: sqlite3 performance problems only in python

2009-07-23 Thread Stef Mientki
Tim Chase wrote: 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" Using the same database in Del

Re: Pyserial and pyQt

2009-07-23 Thread Robert Franke
On Tue, Jul 21, 2009 at 9:37 PM, Seth wrote: > > I have used pyserial in the past but this is my first experience with > pyQt. I am using the Python xy package for windows current but might > move to linux. I have a small device that is outputting a basic text > string. I want to be able to re

Re: raster (PIL)

2009-07-23 Thread superpollo
Peter Otten wrote: ... Here's a different approach: ... raster_string = ... width = raster_string.index("\n") height = raster_string.count("\n") your approach has a funny side-effect: try to remove just one zero from the first line of the raster ;-) bye -- http://mail.python.org/mailman/l

Re: raster (PIL)

2009-07-23 Thread superpollo
Peter Otten wrote: ... im.convert("1").save(sys.stdout, "PNG") ... a q about pil: im.convert("1") is different from: im2 = im.convert("1") right? in the former im is changed (the method applies to im) but in the latter im is unchanged (first im is copied unto im2 and then the method is a

Re: Detect target name in descriptor __set__ method

2009-07-23 Thread DG
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 = "value" > > > Isn't this going t

Re: regex: multiple matching for one string

2009-07-23 Thread Mark Lawrence
scriptlear...@gmail.com wrote: 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=*;') m = p.match(

Re: raster (PIL)

2009-07-23 Thread Diez B. Roggisch
superpollo wrote: > Diez B. Roggisch wrote: >> superpollo wrote: > ... >>>high = len(raster_lines) >>>wide = len(raster_lines[0]) >>>bytes_in_a_row = wide/bits_in_a_byte >> >> >> This will give you the wrong result if not divideable by bits_in_a_byte. >> > > then maybe: > > #!/usr/bin/env pyt

Re: Predefined Variables

2009-07-23 Thread Diez B. Roggisch
Fred Atkinson wrote: > Is there a pre-defined variable that returns the GET line > (http://www.php.net/index.php?everythingafterthequestionmark) as a > single variable (rather than individual variables)? Variables don't return things. Functions do. And additionally the answer depends on what and

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

2009-07-23 Thread paul
Krishnakant schrieb: On Thu, 2009-07-23 at 13:50 +0200, paul wrote: If the user running python program is allowed to call setuid() then yes. NO, i don't think i can do that. I am getting opperation not permitted. Any ways I think probably subprocess will have to sort it out. Did you try r

Re: raster (PIL)

2009-07-23 Thread Peter Otten
superpollo wrote: > Peter Otten wrote: > ... >> im.convert("1").save(sys.stdout, "PNG") > ... > > a q about pil: > > im.convert("1") > > is different from: > > im2 = im.convert("1") > > right? > > in the former im is changed (the method applies to im) but in the latter > im is unchanged (fir

Re: raster (PIL)

2009-07-23 Thread superpollo
Peter Otten wrote: superpollo wrote: Peter Otten wrote: ... im.convert("1").save(sys.stdout, "PNG") ... a q about pil: im.convert("1") is different from: im2 = im.convert("1") right? in the former im is changed (the method applies to im) but in the latter im is unchanged (first im is

Re: JavaScript toolkits (was Re: ANN: Porcupine Web Application Server 0.6 is released!)

2009-07-23 Thread Paul Boddie
On 23 Jul, 05:55, a...@pythoncraft.com (Aahz) wrote: > In article > <1c994086-8c58-488f-b3b3-6161c4b2b...@k30g2000yqf.googlegroups.com>, > Paul Boddie   wrote: > > >http://www.boddie.org.uk/python/XSLTools.html > > Thanks!  I'll take a look after OSCON. The JavaScript parts of the framework are a

Re: raster (PIL)

2009-07-23 Thread Peter Otten
superpollo wrote: > Peter Otten wrote: >> superpollo wrote: >> >> >>>Peter Otten wrote: >>>... >>> im.convert("1").save(sys.stdout, "PNG") >>> >>>... >>> >>>a q about pil: >>> >>>im.convert("1") >>> >>>is different from: >>> >>>im2 = im.convert("1") >>> >>>right? >>> >>>in the former im is c

Re: how two join and arrange two files together

2009-07-23 Thread amrita
I tried to print those lines having C value missing by: import re expr = re.compile("C = None") f = open("/home/amrita/helix.dat") for line in f: if expr.search(line): print line but it is not giving any value. > > Hi, > > I have two large files: > > FileA > 15 ALA H = 8.05 N =

Re: Detect target name in descriptor __set__ method

2009-07-23 Thread DG
On Jul 23, 7:19 am, DG wrote: > 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() > > > >

Re: Detect target name in descriptor __set__ method

2009-07-23 Thread Rhodri James
On Thu, 23 Jul 2009 01:05:55 +0100, 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 = "value" Isn't this going to create a brand ne

import vs imp and friends.

2009-07-23 Thread Emanuele D'Arrigo
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 complete snippets available they show how a modul

Re: ANN: psyco V2

2009-07-23 Thread Neuruss
It seems psyco.org is still in the transfer process... Is there any charitable soul with a link to a Windows binary? :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: import vs imp and friends.

2009-07-23 Thread Christian Heimes
Emanuele D'Arrigo wrote: > Now the question. Apart from checking sys.module first and eventually > adding the new module to it if it isn't there already, and apart from > setting __file__, is there anything else that import does and this > snippet doesn't? The import statement does several things.

Re: Detect target name in descriptor __set__ method

2009-07-23 Thread Rainer Mansfeld
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 assigned to? ('foo' in this example). That is, I want to

Re: ANN: psyco V2

2009-07-23 Thread Christian Heimes
Neuruss wrote: > It seems psyco.org is still in the transfer process... > Is there any charitable soul with a link to a Windows binary? :-) It seems like Christian is already working on Windows binaries. We are having a discussing about an obscure MinGW bug on the Python developer list. It looks l

Re: ANN: psyco V2

2009-07-23 Thread Christian Heimes
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 64bit POSIX (Linux) systems? Christian -

Re: regex: multiple matching for one string

2009-07-23 Thread Nick Dumas
-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.com wrote: >> For example, I have

Office COM automatisation - calling python from VBA

2009-07-23 Thread Dushku, Aaron - Amherst, MA
I'd like a copy of that code. Thanks for taking the time for all of us. Sincerely, Aaron Dushku ** Aaron Dushku GIS Specialist USDA-NRCS Amherst, Massachusetts (413) 253-4379 Email: aaron.dushku at ma.usda.gov -- http://mail.python.org/mailman/listinfo/python-li

win32clipboard operation

2009-07-23 Thread LeeRisq
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:) import xlrd import win32clipboard def program_uno(): ofile = open(r"C:\Query\DQL.

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: regex: multiple matching for one string

2009-07-23 Thread Bill Davy
"Mark Lawrence" wrote in message news:mailman.3588.1248355389.8015.python-l...@python.org... > scriptlear...@gmail.com wrote: >> 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? Th

extract c/cpp include file with regular expression

2009-07-23 Thread tiefeng wu
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"') >>> m.

Cannot Get Form To Work

2009-07-23 Thread Victor Subervi
Hi: When the form comes up the first time, there is the default value for num. When I fill in a number in the form and press send, even though the form sends to itself (same page name), I would think it would read the number sent. Here again is the code: from primeNumbers import primeNumbers try:

strange python scripting error

2009-07-23 Thread Mark Tarver
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 page with Hello, Linux

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=*;'

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: 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: 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: 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: 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: 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: 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: 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: 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
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: 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: 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: 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: 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: 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: 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

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: 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

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: 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: 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: 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: 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: 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 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

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

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

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

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: 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: 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: 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

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: 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_

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

  1   2   >