Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread Sandhya Prabhakaran
Hi, I have a string as str='123ACTGAAC'. I need to extract the numeric part from the alphabetic part which I did using >>>numer=re.findall(r'\d+',str) >>>numer 123 To get the alphabetic part, I could do >>>alpha=str.replace('123','') >>>alpha ACTGAAC But when I give >>>alpha=str.replace(numer,''

Re: A Bug By Any Other Name ...

2009-08-03 Thread J. Cliff Dyer
On Sun, 2009-08-02 at 14:14 +, Albert van der Horst wrote: > >This is actually quite thoroughly untrue. In python, *indentation* > is > >significant. Whitespace (internal to a line) is not. You can even > call > >methods like this if you want: > > You totally don't get it. You describe how

Re: RE Question

2009-08-03 Thread tiefeng wu
2009/8/3 Victor Subervi : -> Hi; -> How do I search and replace something like this: > aLine = re.sub('[<]?[p]?[>]? a-zA-Z0-9"\'=:]*>[<]?[b]?[>]?', '', aLine) > where RE *only* looks for the possibility of "" at the beginning of the > string; that is, not the individual components as I have it code

[ANNC] pybotwar-0.3

2009-08-03 Thread Lee Harr
pybotwar is a fun and educational game where players create computer programs to control simulated robots to compete in a battle arena. http://pybotwar.googlecode.com/ pybotwar uses pybox2d for the physical simulation, and uses pygame and pygsear for the visualization. pybotwar is released und

Re: Test for Pythonwin?

2009-08-03 Thread steve
"steve" wrote in message news:4a728aac$0$9744$5a62a...@per-qv1-newsreader-01.iinet.net.au... > Is there a good way to check if a script is running inside Pythonwin? > Perhaps a property or method that is exposed by that environment? > > or, alternatively, is there a better place to ask :-) > > S

Re: Printing with colors in a portable way

2009-08-03 Thread Aahz
In article <33e19169-19b4-497a-b262-2bcf7b563...@r38g2000yqn.googlegroups.com>, Robert Dailey wrote: > >Anyone know of a way to print text in Python 3.1 with colors in a >portable way? In other words, I should be able to do something like >this: > >print_color( "This is my text", COLOR_BLUE ) > >

Re: Printing with colors in a portable way

2009-08-03 Thread r
On Aug 2, 9:52 pm, a...@pythoncraft.com (Aahz) wrote: [snip] > Much as I hate to say, use a cross-platform GUI -- Tkinter comes with > Python, [snip] Why is Tkinter such a whipping boy of the Python community? I know it's very simple and does not have all the bells and whistles of wx, but i think

Re: Is python buffer overflow proof?

2009-08-03 Thread Diez B. Roggisch
Marcus Wanner schrieb: On 8/2/2009 10:43 AM, Christian Heimes wrote: Marcus Wanner wrote: I believe that python is buffer overflow proof. In fact, I think that even ctypes is overflow proof... No, ctypes isn't buffer overflow proof. ctypes can break and crash a Python interpreter easily. C

Re: Processes not exiting

2009-08-03 Thread ma3mju
On 2 Aug, 21:49, Piet van Oostrum wrote: > > MRAB (M) wrote: > >M> I wonder whether one of the workers is raising an exception, perhaps due > >M> to lack of memory, when there are large number of jobs to process. > > But that wouldn't prevent the join. And you would probably get an > exceptio

Re: problem in event handling on change of variable value.

2009-08-03 Thread sirjee
On Aug 1, 2:22 pm, sirjee wrote: > hello; > > i m facing a problem in handling events on change of value of > environment variable in a toolCANoe. > > class CANoeEvents: >     def OnChange(self,value): >         print "value of environment variable has changed" >     def OnOpen(self,App): >      

Re: Is python buffer overflow proof?

2009-08-03 Thread Marcus Wanner
On 8/3/2009 3:45 AM, Diez B. Roggisch wrote: Marcus Wanner schrieb: On 8/2/2009 10:43 AM, Christian Heimes wrote: Marcus Wanner wrote: I believe that python is buffer overflow proof. In fact, I think that even ctypes is overflow proof... No, ctypes isn't buffer overflow proof. ctypes can bre

"PAKISTAN NEWS" "PAKISTANI NEWSPAPERS" "MAGAZINES ON LINE" "URDU LANGUAGE SOFTWARES" "URDU POETRY PAKISTAN" "PAKISTANI WEB SITE DIRECTOR" "PAKISTANI NEWSPAPERS" "PAKISTAN" "PAKISTAN" on www.pak-web-p

2009-08-03 Thread Riaz Ahmad
"PAKISTAN NEWS" www.pak-web-pages.blogspot.com "PAKISTANI NEWSPAPERS" www.pak-web-pages.blogspot.com "MAGAZINES ON LINE" www.pak-web-pages.blogspot.com "URDU LANGUAGE SOFTWARES" www.pak-web-pages.blogspot.com "URDU POETRY PAKISTAN" www.pak-web-pages.blogspot.com "PAKISTANI WEB

Executing remote command with paramiko

2009-08-03 Thread Hussein B
Hey, I'm trying to run a sudo guarded command over SSH using paramiko +++ s = paramiko.SSHClient() s.load_system_host_keys() s.connect(hostname, port, username, passwd) stdin, stdout, stderr = s.exec_command('sudo -s') stdin.write('password\n') stdin.flush() print 'Flushing' stdin,

Re: heapq "key" arguments

2009-08-03 Thread Duncan Booth
"Gabriel Genellina" wrote: > Ok, it's not strictly the same, but usually it doesn't hurt. The heaqp > module doesn't promise anything about equal elements: it may keep the > original order, rearrange them at will, reverse them, whatever. The documentation doesn't say anything directly about st

Re: New implementation of re module

2009-08-03 Thread John Machin
On Jul 28, 2:34 am, MRAB wrote: > Hi all, > > I've been working on a new implementation of the re module. The details > are athttp://bugs.python.org/issue2636, specifically > fromhttp://bugs.python.org/issue2636#msg90954. I've included a .pyd file for > Python 2.6 on Windows if you want to try it

Announcing PythonTurtle

2009-08-03 Thread cool-RR
Hello, I wanted to announce that I have just released my little side project, PythonTurtle. Here is its website: http://pythonturtle.com Its goal is to be the lowest-threshold way to learn (or teach) Python. You can read more about it and download it on the website. Ram. -- http://mail.python.o

Python configuration question when python scripts are executed using Appweb as web server.

2009-08-03 Thread IronyOfLife
Hi All I have installed python 2.6.2 in windows xp professional machine. I have set the following environment variables -- PYTHONPATH. It points to following windows folders: python root folder, the lib folder and lib-tk folder. I have configured IIS to execute python scripts. I do not have any i

Re: Announcing PythonTurtle

2009-08-03 Thread André
On Aug 3, 10:18 am, cool-RR wrote: > Hello, > > I wanted to announce that I have just released my little side project, > PythonTurtle. > Here is its website:http://pythonturtle.com > > Its goal is to be the lowest-threshold way to learn (or teach) Python. > You can read more about it and download

Re: Announcing PythonTurtle

2009-08-03 Thread Hilmar Bunjes
André schrieb: I wanted to announce that I have just released my little side project, PythonTurtle. Here is its website:http://pythonturtle.com Its goal is to be the lowest-threshold way to learn (or teach) Python. You can read more about it and download it on the website. Ram. Why not make

Re: Announcing PythonTurtle

2009-08-03 Thread cool-RR
On Aug 3, 5:53 pm, André wrote: > On Aug 3, 10:18 am, cool-RR wrote: > > > Hello, > > > I wanted to announce that I have just released my little side project, > > PythonTurtle. > > Here is its website:http://pythonturtle.com > > > Its goal is to be the lowest-threshold way to learn (or teach) Pyt

RE: Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread Andreas Tawn
> Hi, > > I have a string as str='123ACTGAAC'. > > I need to extract the numeric part from the alphabetic part which I > did using > >>>numer=re.findall(r'\d+',str) > >>>numer > 123 > > To get the alphabetic part, I could do > >>>alpha=str.replace('123','') > >>>alpha > ACTGAAC > But when I giv

Re: Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread Peter Brett
Sandhya Prabhakaran writes: > Hi, > > I have a string as str='123ACTGAAC'. > > I need to extract the numeric part from the alphabetic part which I > did using numer=re.findall(r'\d+',str) numer > 123 > > To get the alphabetic part, I could do alpha=str.replace('123','') alpha > AC

Re: Printing with colors in a portable way

2009-08-03 Thread Jean-Michel Pichavant
Nobody wrote: On Thu, 30 Jul 2009 15:40:37 -0700, Robert Dailey wrote: Anyone know of a way to print text in Python 3.1 with colors in a portable way? In other words, I should be able to do something like this: print_color( "This is my text", COLOR_BLUE ) And this should be portable (i.e.

Compiling regex inside function?

2009-08-03 Thread Anthra Norell
Hi all, I have a regex that has no use outside of a particular function. From an encapsulation point of view it should be scoped as restrictively as possible. Defining it inside the function certainly works, but if re.compile () is run every time the function is called, it isn't such a good

Re: Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread MRAB
Sandhya Prabhakaran wrote: Hi, I have a string as str='123ACTGAAC'. I need to extract the numeric part from the alphabetic part which I did using numer=re.findall(r'\d+',str) numer 123 [snip] I get: ['123'] which is a _list_ of the strings found. -- http://mail.python.org/mailman/listinf

M2Crypto: X509.X509_Extension_Stack() throws AssertionError

2009-08-03 Thread Matthias Güntert
Hello python-list members Why is the following code snippet throwing an AssertionError? Is that behavior a bug within X509.X509_Extension_Stack()? How would you suggest popping every element from the stack? Regards, Matthias Güntert - from M2Crypt

Re: Generate a new object each time a name is imported

2009-08-03 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: I would like to generate a new object each time I import a name from a module, rather than getting the same object each time. For example, currently I might do something like this: # Module count = 0 def factory(): # Generate a unique object each time this is called

Re: Queryable Daemon

2009-08-03 Thread Michael Torrie
Justin DeCell wrote: > I was hoping for a little help with a project I'm working on. I'm > writing a daemon in python that I want to be queryable (i.e. I should > be able to run foo -s and it will report some internal information > about the foo daemon if it's running) but I can't figure out

Re: Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread Kushal Kumaran
On Mon, Aug 3, 2009 at 8:47 PM, Sandhya Prabhakaran wrote: > Hi, > > I have a string as str='123ACTGAAC'. > > I need to extract the numeric part from the alphabetic part which I > did using numer=re.findall(r'\d+',str) numer > 123 > The docs for re.findall say that it returns a list of mat

Re: New implementation of re module

2009-08-03 Thread MRAB
John Machin wrote: On Jul 28, 2:34 am, MRAB wrote: Hi all, I've been working on a new implementation of the re module. The details are athttp://bugs.python.org/issue2636, specifically fromhttp://bugs.python.org/issue2636#msg90954. I've included a .pyd file for Python 2.6 on Windows if you wan

Re: Compiling regex inside function?

2009-08-03 Thread Diez B. Roggisch
Anthra Norell wrote: > Hi all, > >I have a regex that has no use outside of a particular function. From > an encapsulation point of view it should be scoped as restrictively as > possible. Defining it inside the function certainly works, but if > re.compile () is run every time the function i

Re: Announcing PythonTurtle

2009-08-03 Thread Colin J. Williams
cool-RR wrote: Hello, I wanted to announce that I have just released my little side project, PythonTurtle. Here is its website: http://pythonturtle.com Its goal is to be the lowest-threshold way to learn (or teach) Python. You can read more about it and download it on the website. Ram. It lo

ANNOUNCE: AwstatsReader 0.01

2009-08-03 Thread Joshua J. Kugler
ABOUT THE MODULE AwstatsReader is an attempt at a pythonic interface to AWStats data cache files.  Using it, you can access year, month, and individual data points via dictionary-like accessors. Download here: http://azariah.com/open_source.html ABOUT THE AUTHOR

Re: Python docs disappointing

2009-08-03 Thread Ethan Furman
Carl Banks wrote: On Jul 31, 1:55 pm, Mark Lawrence wrote: Apart from that what have the Pythonistas ever done for us? Nothing!:) Please don't feed the trolls. And if you do feed the trolls don't smile at them. Carl Banks And if you do smile at them, don't show your teeth! ~Ethan~ --

urllib2.urlopen timeout

2009-08-03 Thread Zdenek Maxa
Hi, I would like to ask how I should set timeout for a call: f = urllib2.urlopen(url) I am using Python 2.5. I have already tried socket.setdefaulttimeout(3). However, this adversely affects other connections the application makes, since it seems to affect all socket connections. I know that Py

Re: Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread alex23
Sandhya Prabhakaran wrote: > I have a string as str='123ACTGAAC'. You shouldn't use 'str' as a label like that, it prevents you from using the str() function in the same body of code. > How do I blank out the initial numeric part so as to get just the > alphabetic part. The string is always in t

Re: Announcing PythonTurtle

2009-08-03 Thread cool-RR
On Aug 3, 7:04 pm, "Colin J. Williams" wrote: > cool-RR wrote: > > Hello, > > > I wanted to announce that I have just released my little side project, > > PythonTurtle. > > Here is its website: > >http://pythonturtle.com > > > Its goal is to be the lowest-threshold way to learn (or teach) Python.

Re: Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread Sandhya Prabhakaran
Oh yes indeed! Now that works :D Thanks a lot !! 2009/8/3 Kushal Kumaran > > On Mon, Aug 3, 2009 at 8:47 PM, Sandhya > Prabhakaran wrote: > > Hi, > > > > I have a string as str='123ACTGAAC'. > > > > I need to extract the numeric part from the alphabetic part which I > > did using >

Re: Help understanding the decisions *behind* python?

2009-08-03 Thread John Nagle
Dave Angel wrote: sturlamolden wrote: On 20 Jul, 18:27, Phillip B Oldham wrote: Tuples are used for passing arguments to and from a function. Common use of tuples include multiple return values and optional arguments (*args). That's from Mesa, the Xerox PARC language of the 1970s. Mesa

Re: heapq "key" arguments

2009-08-03 Thread Raymond Hettinger
[Duncan Booth] > The documentation doesn't say anything directly about stability, but the > implementation is actually stable. You can probably assume it must be at > least for nlargest and nsmallest otherwise the stated equivalence wouldn't > hold: > > e.g. nsmallest documentation says: > >      

Re: Compiling regex inside function?

2009-08-03 Thread alex23
Anthra Norell wrote: > def entries (l): >         r = re.compile ('([0-9]+) entr(y|ies)') >         match = r.search (l) >         if match: return match.group (1) > > So the question is: does "r" get regex-compiled once at py-compile time > or repeatedly at entries() run time? The docs say: The

Re: Help understanding the decisions *behind* python?

2009-08-03 Thread alex23
John Nagle wrote: > Every function returned a tuple as an argument. This had a nice > symmetry; function outputs and function inputs had the same form.   > Mesa was the first language to break through the "single return > value" syntax problem. > >     Python doesn't go that far. I assume here y

Re: iterate lines with regex

2009-08-03 Thread Robert Kern
On 2009-08-01 14:39, Michael Savarese wrote: I'm a python newbie and I'm trying to test several regular expressions on the same line before moving on to next line. it seems to move on to next line before trying all regular expressions which is my goal. it only returns true for first regular expr

Re: RE Question

2009-08-03 Thread Gabriel Genellina
En Sun, 02 Aug 2009 18:22:20 -0300, Victor Subervi escribió: How do I search and replace something like this: aLine = re.sub('[<]?[p]?[>]?[<]?[b]?[>]?', '', aLine) where RE *only* looks for the possibility of "" at the beginning of the string; that is, not the individual components as I hav

Re: Queryable Daemon

2009-08-03 Thread Nobody
On Sun, 02 Aug 2009 19:36:08 -0600, Michael Torrie wrote: > Another possibility is shared memory segments. I'm not sure how > security is done in this case. Shared memory segments have an owner, group, and the standard ugo=rwx permissions (execute permission is present but ignored); see the shmg

Re: iterate lines with regex

2009-08-03 Thread MRAB
Robert Kern wrote: [snip] for line in readThis: key_match = key.search(line) if key_match is not None: this_key = key_match.group(1) # ... do something with this_key map_match = map.search(line) if map_match is not None: this_map = map_match.group(1)

Re: Run pyc file without specifying python path ?

2009-08-03 Thread Dave Angel
Barak, Ron wrote: -Original Message- From: Dave Angel [mailto:da...@ieee.org] Sent: Sunday, August 02, 2009 12:36 To: Barak, Ron Cc: 'python-list@python.org' Subject: Re: Run pyc file without specifying python path ? Barak, Ron wrote: Hi Dave, It seems like I don't understand y

Re: heapq "key" arguments

2009-08-03 Thread Raymond Hettinger
[Joshua Bronson]: > According tohttp://docs.python.org/library/heapq.html, Python 2.5 > added an optional "key" argument to heapq.nsmallest and > heapq.nlargest. I could never understand why they didn't also add a > "key" argument to the other relevant functions (heapify, heappush, > etc). The pro

Re: Compiling regex inside function?

2009-08-03 Thread Duncan Booth
alex23 wrote: > The docs say: > The compiled versions of the most recent patterns passed to re.match > (), re.search() or re.compile() are cached, so programs that use only > a few regular expressions at a time needn’t worry about compiling > regular expressions. > > (But they don't say how few

Re: urllib2.urlopen timeout

2009-08-03 Thread Ben Charrow
Zdenek Maxa wrote: > Hi, > > I would like to ask how I should set timeout for a call: > > f = urllib2.urlopen(url) > > > I know that Python 2.6 offers > urllib2.urlopen(url[, data][, timeout]) > which would elegantly solved my problem, but I have to stick to Python 2.5. > There are three sol

Can python do something like the onclick events in javascript ?

2009-08-03 Thread Leo Brugud
I'm trying to use python to build a simple web page that make use of the onclick behavior, instead of requiring users to click the 'submit' button. I realize in javascript there are onclick, onchange events. Is python capable of doing the same? Thanks in Advance -- http://mail.python.org/mailman

Re: iterate lines with regex

2009-08-03 Thread Robert Kern
On 2009-08-03 12:29, MRAB wrote: Robert Kern wrote: [snip] for line in readThis: key_match = key.search(line) if key_match is not None: this_key = key_match.group(1) # ... do something with this_key map_match = map.search(line) if map_match is not None: this_map = map_match.group(1) # ... do so

Re: Can python do something like the onclick events in javascript ?

2009-08-03 Thread Diez B. Roggisch
Leo Brugud schrieb: I'm trying to use python to build a simple web page that make use of the onclick behavior, instead of requiring users to click the 'submit' button. If that's the only reason, don't use JS for that, it's annoying. I realize in javascript there are onclick, onchange events.

Re: Can python do something like the onclick events in javascript ?

2009-08-03 Thread Benjamin Kaplan
On Mon, Aug 3, 2009 at 2:39 PM, Leo Brugud wrote: > I'm trying to use python to build a simple web page that make use of > the onclick behavior, instead of requiring users > to click the 'submit' button. > > I realize in javascript there are onclick, onchange events. Is python > capable of doing t

"MAGZINES IN URDU" "PAKISTANI MAGZINES" PAKISTAN" "PAKISTAN" "PAKISTANI NEWSPAPERS" "tHE eXPRTESS" "JANG NEWS" "WAQT" "DAWN" ON www.pak-web-pages.blogspot.com

2009-08-03 Thread saima81
"MAGZINES IN URDU" "PAKISTANI MAGZINES" PAKISTAN" "PAKISTAN" "PAKISTANI NEWSPAPERS" "tHE eXPRTESS" "JANG NEWS" "WAQT" "DAWN" ON www.pak-web-pages.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Online payment module

2009-08-03 Thread Sam Tregar
Hello all. I'm considering building a module to provide a cross-payment-gatewat API for making online payments. In the Perl world we have a module like this called Business::OnlinePayment ( http://search.cpan.org/~jasonk/Business-OnlinePayment-2.01/OnlinePayment.pm). Is there anything like this

Re: .dbf tables and Null

2009-08-03 Thread Ethan Furman
John Machin wrote: On Aug 1, 3:41 am, Ethan Furman wrote: Mornin'! and a good one, too, I hope. Question for you... First part of the question: What is the general value in having Null capability for fields? In general, in any database system, so that one can distinguish between "the cu

kw param question

2009-08-03 Thread kj
I want to write a decorator that, among other things, returns a function that has one additional keyword parameter, say foo=None. When I try def my_decorator(f): # blah, blah def wrapper(*p, foo=None, **kw): x = f(*p, **kw) if (foo): # blah, blah else

Re: M2Crypto: X509.X509_Extension_Stack() throws AssertionError

2009-08-03 Thread Heikki Toivonen
Matthias Güntert wrote: > Why is the following code snippet throwing an AssertionError? Is that > behavior a bug within X509.X509_Extension_Stack()? How would you suggest > popping every element from the stack? > > cert_extension_2 = X509.new_extension("keyUsage", "10100") Maybe your

Re: kw param question

2009-08-03 Thread Albert Hopkins
On Mon, 2009-08-03 at 19:59 +, kj wrote: > > I want to write a decorator that, among other things, returns a > function that has one additional keyword parameter, say foo=None. > > When I try > > def my_decorator(f): > # blah, blah > def wrapper(*p, foo=None, **kw): > x = f(*

Re: Announcing PythonTurtle

2009-08-03 Thread r
Hello, I wanted to announce that I have just released my little side project, PythonTurtle. [snip] I think it looks great --haven't download the source yet-- but i really like the screenshot. This will be more "inviting" to the new, inexperianced users. I like the idea of packaging up the command

easy_install: unresolved external symbol

2009-08-03 Thread Bart Smeets
Hello, I keep getting errors when trying to use easy_install to install bbfreeze or cxfreeze (same errors). This is the output: http://pastebin.com/m65ba474d The error message unresolved external symbol keeps popping up. I have no idea how to solve this. Can anyone give me a hint? Thanks in adv

Ordering of dict keys & values

2009-08-03 Thread Wells Oliver
I understand that the keys in a dictionary are ordered not randomly but something practically close to it, but if I create a SQL query like so: query = 'INSERT INTO Batting (%s) VALUES(%s)' % (','.join(stats.keys()), ','.join(stats.values())) Can I at least rely on the value being in the same ind

Re: Newbie Question regarding __init__()

2009-08-03 Thread Simon
On Aug 2, 5:51 am, Dave Angel wrote: > Simon wrote: > > Okay I will fix my code and include "self" and see what happens.  I > > know I tried that before and got another error which I suspect was > > another newbie error. > > > The idea behind the init_Pre is that I can put custom code here to > >

Re: kw param question

2009-08-03 Thread kj
In Albert Hopkins writes: >On Mon, 2009-08-03 at 19:59 +, kj wrote: >> >> I want to write a decorator that, among other things, returns a >> function that has one additional keyword parameter, say foo=None. >> >> When I try >> >> def my_decorator(f): >> # blah, blah >> def wrappe

Re: iterate lines with regex

2009-08-03 Thread Carl Banks
On Aug 3, 11:44 am, Robert Kern wrote: > On 2009-08-03 12:29, MRAB wrote: > > > > > > > Robert Kern wrote: > > [snip] > > >> for line in readThis: > >> key_match = key.search(line) > >> if key_match is not None: > >> this_key = key_match.group(1) > >> # ... do something with this_key > >> map_matc

Re: Is python buffer overflow proof?

2009-08-03 Thread sturlamolden
On 2 Aug, 15:50, Jizzai wrote: > Is a _pure_ python program buffer overflow proof? > > For example in C++ you can declare a char[9] to hold user input. > If the user inputs 10+ chars a buffer overflow occurs. Short answer: NO Bounds checking on sequence types is a protection against buffer over

no-clobber dicts?

2009-08-03 Thread kj
I use the term "no-clobber dict" to refer to a dictionary D with the especial property that if K is in D, then D[K] = V will raise an exception unless V == D[K]. In other words, D[K] can be set if K doesn't exist already among D's keys, or if the assigned value is equal to the current valu

Re: Ordering of dict keys & values

2009-08-03 Thread Chris Rebert
On Mon, Aug 3, 2009 at 1:47 PM, Wells Oliver wrote: > I understand that the keys in a dictionary are ordered not randomly but > something practically close to it, but if I create a SQL query like so: > > query = 'INSERT INTO Batting (%s) VALUES(%s)' % (','.join(stats.keys()), > ','.join(stats.value

WindowsError: exception: access violation writing 0x00000000

2009-08-03 Thread Sparky
Hello! I am using cTypes on Windows to interface with a dll and I keep getting an error when I execute this method: def eDigitalIn(self, channel, idNum = None, demo = 0, readD=0): """ Name: U12.eAnalogIn(channel, idNum = None, demo = 0, readD=0) Args: See section 4.4 of the

Trying to get ABC to work

2009-08-03 Thread Boris Arloff
Hi,   Looking for ideas on getting Abstract Base Classes to work as intended within a metaclass.   I was wondering if I could use an abc method within a metaclass to force a reimplementation when a class is instantiated from the metaclass.  It seems like I cannot do so.  I implemented the follow

Re: no-clobber dicts?

2009-08-03 Thread r
On Aug 3, 4:07 pm, kj wrote: > I use the term "no-clobber dict" to refer to a dictionary D with > the especial property that if K is in D, then > >   D[K] = V > > will raise an exception unless V == D[K].  In other words, D[K] > can be set if K doesn't exist already among D's keys, or if the > ass

Re: no-clobber dicts?

2009-08-03 Thread Chris Rebert
On Mon, Aug 3, 2009 at 2:47 PM, r wrote: > On Aug 3, 4:07 pm, kj wrote: >> I use the term "no-clobber dict" to refer to a dictionary D with >> the especial property that if K is in D, then >> >>   D[K] = V >> >> will raise an exception unless V == D[K].  In other words, D[K] >> can be set if K doe

Re: Registation is open for the 9th PyWeek game programming challenge!

2009-08-03 Thread Greg Ewing
Richard Jones wrote: The ninth PyWeek challenge will run between: Sunday 30th August to Sunday 6th September (00:00UTC to 00:00UTC) Yow, hard on the heels of Pyggy! I'd hoped there might be a bit more breathing room, sorry about that! Hope the Pyggy entrants aren't feeling too burned out to

Re: Announcing PythonTurtle

2009-08-03 Thread cool-RR
On Aug 3, 11:35 pm, r wrote: > Hello, > I wanted to announce that I have just released my little side > project, > PythonTurtle. > [snip] > > I think it looks great --haven't download the source yet-- but i > really like the screenshot. This will be more "inviting" to the new, > inexperianced user

Re: socket policy flash help

2009-08-03 Thread NighterNet
On Aug 2, 12:25 pm, Piet van Oostrum wrote: > > NighterNet (N) wrote: > >N> Here the full code. > >N> flashpolicy.xml > >N> [[[ > >N> > >N> > >N>     > >N> > >N> ]]] > >N> flashpolicytest_server3x.py > >N> [[[ > >N> #!/usr/local/bin/python > >N> ''' > >N> Still under testing... > >N> pytho

Obtaining Python version

2009-08-03 Thread John Nagle
This works, but it seems too cute: >>> pyver = map(int,sys.version.split()[0].split('.')) >>> print(pyver) [2, 6, 1] Is it guaranteed that the Python version string will be in a form suitable for that? In other words, does "sys.version" begin N.N.N other stuff in all versions, and will it sta

Re: fast video encoding

2009-08-03 Thread Rhodri James
On Sun, 02 Aug 2009 03:44:17 +0100, sturlamolden wrote: On 29 Jul, 10:14, gregorth wrote: for a scientific application I need to save a video stream to disc for further post processing. I have worked a bit on this as well. There are two things that make scientific applications different

Re: Obtaining Python version

2009-08-03 Thread André
On Aug 3, 7:19 pm, John Nagle wrote: > This works, but it seems too cute: > >  >>> pyver = map(int,sys.version.split()[0].split('.')) >  >>> print(pyver) > [2, 6, 1] > You can also do: >>> import sys >>> sys.version_info (2, 5, 2, 'final', 0) or >>> sys.version_info[:3] (2, 5, 2) > Is it guara

Re: RE Question

2009-08-03 Thread Victor Subervi
That worked. Thank you again :) Victor On Mon, Aug 3, 2009 at 12:13 AM, Gabriel Genellina wrote: > En Sun, 02 Aug 2009 18:22:20 -0300, Victor Subervi < > victorsube...@gmail.com> escribió: > > > How do I search and replace something like this: >> aLine = re.sub('[<]?[p]?[>]?> a-zA-Z0-9"\'=:]*>[<

Re: Announcing PythonTurtle

2009-08-03 Thread r
On Aug 3, 5:03 pm, cool-RR wrote: [snip] > Thanks for the compliments; The things you mentioned you liked are all > things that I was specifically thinking about when I decided to make > PythonTurtle. Well, maybe minus the screenshot :) I *may* get roasted for this comment, but i think a turtle m

Re: Obtaining Python version

2009-08-03 Thread Jan Kaliszewski
04-08-2009 o 00:19:22 John Nagle wrote: This works, but it seems too cute: >>> pyver = map(int,sys.version.split()[0].split('.')) >>> print(pyver) [2, 6, 1] Is it guaranteed that the Python version string will be in a form suitable for that? In other words, does "sys.version" begin N.N.N

Problem with reading CSV file from URL, last record truncated.

2009-08-03 Thread KB
Hi, I am trying to download from a URL, a CSV using the following: import re import urllib, urllib2, cookielib import mechanize import csv import numpy import os def return_ranking(): cj = mechanize.MSIECookieJar(delayload=True) cj.load_from_registry() # finds cookie index fil

Re: Problem with reading CSV file from URL, last record truncated.

2009-08-03 Thread KB
On Aug 3, 3:54 pm, KB wrote: > Hi, > > I am trying to download from a URL, a CSV using the following: > > import re > import urllib, urllib2, cookielib > import mechanize > import csv > import numpy > import os > > def return_ranking(): > >         cj = mechanize.MSIECookieJar(delayload=True) >  

Re: Executing remote command with paramiko

2009-08-03 Thread Piet van Oostrum
> Hussein B (HB) wrote: >HB> Hey, >HB> I'm trying to run a sudo guarded command over SSH using paramiko >HB> +++ >HB> s = paramiko.SSHClient() >HB> s.load_system_host_keys() >HB> s.connect(hostname, port, username, passwd) >HB> stdin, stdout, stderr = s.exec_command('sudo -s')

Re: Help understanding the decisions *behind* python?

2009-08-03 Thread greg
John Nagle wrote: Mesa used tuples for subroutine arguments in a very straightforward way. Every function took one tuple as an argument Python doesn't go that far. I believe that a very early version of Python did do something like that, but it was found to be a bad idea, because there was

Re: no-clobber dicts?

2009-08-03 Thread r
On Aug 3, 5:00 pm, Chris Rebert wrote: > On Mon, Aug 3, 2009 at 2:47 PM, r wrote: [snip] > > Not sure if something like this already exists, but it would be > > trivial to implement by overriding dict.__setitem__() > > That is, if you don't care about .update() not preserving the > invariant. Othe

Re: Problem with reading CSV file from URL, last record truncated.

2009-08-03 Thread MRAB
KB wrote: On Aug 3, 3:54 pm, KB wrote: Hi, I am trying to download from a URL, a CSV using the following: import re import urllib, urllib2, cookielib import mechanize import csv import numpy import os def return_ranking(): cj = mechanize.MSIECookieJar(delayload=True) cj.load

Re: Announcing PythonTurtle

2009-08-03 Thread Mensanator
On Aug 3, 8:18 am, cool-RR wrote: > Hello, > > I wanted to announce that I have just released my little side project, > PythonTurtle. > Here is its website:http://pythonturtle.com > > Its goal is to be the lowest-threshold way to learn (or teach) Python. > You can read more about it and download i

Extracting text from html

2009-08-03 Thread VanL
Hello all, Does anyone know of a good tool to get a minimally-formatted text document out of an html document? Something along the lines of what you would get with a lynx -dump, but in Python. I have lxml installed, so I can roll my own if I need to. However, this seemed like the sort of thi

Re: Python configuration question when python scripts are executed using Appweb as web server.

2009-08-03 Thread Gabriel Genellina
En Mon, 03 Aug 2009 11:04:07 -0300, IronyOfLife escribió: I have installed python 2.6.2 in windows xp professional machine. I have set the following environment variables -- PYTHONPATH. It points to following windows folders: python root folder, the lib folder and lib-tk folder. Why? Did yo

Re: easy_install: unresolved external symbol

2009-08-03 Thread Gabriel Genellina
En Mon, 03 Aug 2009 17:39:44 -0300, Bart Smeets escribió: I keep getting errors when trying to use easy_install to install bbfreeze or cxfreeze (same errors). This is the output: http://pastebin.com/m65ba474d Can't you use the binary packages? -- Gabriel Genellina -- http://mail.python.

Re: Ordering of dict keys & values

2009-08-03 Thread Gabriel Genellina
En Mon, 03 Aug 2009 17:47:23 -0300, Wells Oliver escribió: I understand that the keys in a dictionary are ordered not randomly but something practically close to it, but if I create a SQL query like so: query = 'INSERT INTO Batting (%s) VALUES(%s)' % (','.join(stats.keys()), ','.join(stats.v

Re: Is python buffer overflow proof?

2009-08-03 Thread Gabriel Genellina
En Mon, 03 Aug 2009 18:04:53 -0300, sturlamolden escribió: On 2 Aug, 15:50, Jizzai wrote: Is a _pure_ python program buffer overflow proof? For example in C++ you can declare a char[9] to hold user input. If the user inputs 10+ chars a buffer overflow occurs. Short answer: NO Bounds ch

Re: merge two png pic

2009-08-03 Thread cocobear
On Jul 31, 2:52 pm, Peter Otten <__pete...@web.de> wrote: > cocobear wrote: > > On Jul 29, 9:20 am, cocobear wrote: > >> Thistwopngfile has their own palette > > >> >>> im1.mode > >> 'P' > >> >>> im.mode > >> 'P' > >> >>> im.getpalette == im1.getpalette > > >> False > > >> I can use this code tome

Re: Announcing PythonTurtle

2009-08-03 Thread Asun Friere
On Aug 4, 6:35 am, r wrote: [snip] > > I can remember the first time i used turtle (in python stdlib) and i > kept saying to myself... > >     "Were the heck is this damn turtle?!?!" (>_<) > > :-) In Python2.6, try this: >>> turtle.shape('turtle') -- http://mail.python.org/mailman/listinfo/py

Re: Seeding the rand() Generator

2009-08-03 Thread Fred Atkinson
On Sun, 2 Aug 2009 17:00:40 -0700 (PDT), Carl Banks wrote: I appreciate the response. I am executing a statement to retrieve one record at random. An example would be: SELECT first, second, third, fourth, fifth, sixth from sometable order by rand() limit 1 I

[OT] Re: Ordering of dict keys & values

2009-08-03 Thread Benjamin Kaplan
On Mon, Aug 3, 2009 at 9:18 PM, Gabriel Genellina wrote: > > [1] If you don't know what "SQL injection" means, see http://xkcd.com/327/ I love how XKCD is one of the preferred learning tools (along with Wikipeida) for people on this list. I think Randall Munroe should make a comic about it. :) --

Re: RUBY vs COMMON LISP

2009-08-03 Thread fft1976
On Aug 3, 1:19 am, p...@informatimago.com (Pascal J. Bourguignon) wrote: > fft1976 writes: > > By the way, here is in 1 line of BF, a complete BF reader that is able > > to > > read all the BF syntax needed to write it: > > > ,+[-.,+] > > > Here's how to try it: > > > $ sudo apt-get install bf > >

Re: Newbie Question regarding __init__()

2009-08-03 Thread Dave Angel
Simon wrote: On Aug 2, 5:51 am, Dave Angel wrote: I don't understand your comparison to Foxpro. read on. As your code was last posted, you don't need a return value from init_Exec() Every function that doesn't have an explicit return will return None. And None is interpreted as False in

  1   2   >