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,'') Traceback

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 python is

Re: RE Question

2009-08-03 Thread tiefeng wu
2009/8/3 Victor Subervi victorsube...@gmail.com: - Hi; - How do I search and replace something like this: aLine = re.sub('[]?[p]?[]?font size=h' + str(x) + '[ a-zA-Z0-9\'=:]*[]?[b]?[]?', 'h' + str(x) + '', aLine) where RE *only* looks for the possibility of p at the beginning of the string;

[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

Re: Test for Pythonwin?

2009-08-03 Thread steve
steve st...@nospam.au 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

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 rcdai...@gmail.com 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,

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.

Re: Processes not exiting

2009-08-03 Thread ma3mju
On 2 Aug, 21:49, Piet van Oostrum p...@cs.uu.nl wrote: MRAB pyt...@mrabarnett.plus.com (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

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

2009-08-03 Thread sirjee
On Aug 1, 2:22 pm, sirjee hitechpun...@gmail.com 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

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

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 SITE

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 gagsl-...@yahoo.com.ar 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

Re: New implementation of re module

2009-08-03 Thread John Machin
On Jul 28, 2:34 am, MRAB pyt...@mrabarnett.plus.com 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

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

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

Re: Announcing PythonTurtle

2009-08-03 Thread André
On Aug 3, 10:18 am, cool-RR ram.rac...@gmail.com 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

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é andre.robe...@gmail.com wrote: On Aug 3, 10:18 am, cool-RR ram.rac...@gmail.com 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

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 give

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

2009-08-03 Thread Peter Brett
Sandhya Prabhakaran sandhyaprabhaka...@gmail.com 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

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

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

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

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 a

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 Prabhakaransandhyaprabhaka...@gmail.com 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

Re: New implementation of re module

2009-08-03 Thread MRAB
John Machin wrote: On Jul 28, 2:34 am, MRAB pyt...@mrabarnett.plus.com 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

Re: Announcing PythonTurtle

2009-08-03 Thread cool-RR
On Aug 3, 7:04 pm, Colin J. Williams c...@ncf.ca 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. You

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 kushal.kumaran+pyt...@gmail.comkushal.kumaran%2bpyt...@gmail.com On Mon, Aug 3, 2009 at 8:47 PM, Sandhya Prabhakaransandhyaprabhaka...@gmail.com wrote: Hi, I have a string as str='123ACTGAAC'. I need

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 phillip.old...@gmail.com 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

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 anthra.nor...@bluewin.ch 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?

Re: Help understanding the decisions *behind* python?

2009-08-03 Thread alex23
John Nagle na...@animats.com 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

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

Re: RE Question

2009-08-03 Thread Gabriel Genellina
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]?[]?font size=h' + str(x) + '[ a-zA-Z0-9\'=:]*[]?[b]?[]?', 'h' + str(x) + '', aLine) where RE *only* looks for the possibility of p at

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

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

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 problem is

Re: Compiling regex inside function?

2009-08-03 Thread Duncan Booth
alex23 wuwe...@gmail.com 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

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) snip 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 solutions

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

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

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 sakradevanamin...@gmail.comwrote: 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

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

Re: .dbf tables and Null

2009-08-03 Thread Ethan Furman
John Machin wrote: On Aug 1, 3:41 am, Ethan Furman et...@stoneleaf.us 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

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

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 OpenSSL

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(*p, **kw)

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

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

Re: Newbie Question regarding __init__()

2009-08-03 Thread Simon
On Aug 2, 5:51 am, Dave Angel da...@ieee.org 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 mailman.4178.1249331189.8015.python-l...@python.org Albert Hopkins mar...@letterboxes.org 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

Re: iterate lines with regex

2009-08-03 Thread Carl Banks
On Aug 3, 11:44 am, Robert Kern robert.k...@gmail.com 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_match =

Re: Is python buffer overflow proof?

2009-08-03 Thread sturlamolden
On 2 Aug, 15:50, Jizzai jiz...@gmail.com 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

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 value

Re: Ordering of dict keys values

2009-08-03 Thread Chris Rebert
On Mon, Aug 3, 2009 at 1:47 PM, Wells Oliverwe...@submute.net 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()),

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

Re: no-clobber dicts?

2009-08-03 Thread r
On Aug 3, 4:07 pm, kj no.em...@please.post 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

Re: no-clobber dicts?

2009-08-03 Thread Chris Rebert
On Mon, Aug 3, 2009 at 2:47 PM, rrt8...@gmail.com wrote: On Aug 3, 4:07 pm, kj no.em...@please.post 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]

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 rt8...@gmail.com 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,

Re: socket policy flash help

2009-08-03 Thread NighterNet
On Aug 2, 12:25 pm, Piet van Oostrum p...@cs.uu.nl wrote: NighterNet darkne...@gmail.com (N) wrote: N Here the full code. N flashpolicy.xml N [[[ N ?xml version=1.0? N cross-domain-policy N    allow-access-from domain=* to-ports=* / N /cross-domain-policy N ]]] N

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 stay that

Re: fast video encoding

2009-08-03 Thread Rhodri James
On Sun, 02 Aug 2009 03:44:17 +0100, sturlamolden sturlamol...@yahoo.no wrote: On 29 Jul, 10:14, gregorth gregor.thalham...@gmail.com 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

Re: Obtaining Python version

2009-08-03 Thread André
On Aug 3, 7:19 pm, John Nagle na...@animats.com 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

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 gagsl-...@yahoo.com.arwrote: 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]?[]?font

Re: Announcing PythonTurtle

2009-08-03 Thread r
On Aug 3, 5:03 pm, cool-RR ram.rac...@gmail.com 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

Re: Obtaining Python version

2009-08-03 Thread Jan Kaliszewski
04-08-2009 o 00:19:22 John Nagle na...@animats.com 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

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

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

2009-08-03 Thread KB
On Aug 3, 3:54 pm, KB ke...@nekotaku.com 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 hubaghd...@gmail.com (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

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

Re: no-clobber dicts?

2009-08-03 Thread r
On Aug 3, 5:00 pm, Chris Rebert c...@rebertia.com wrote: On Mon, Aug 3, 2009 at 2:47 PM, rrt8...@gmail.com 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

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 ke...@nekotaku.com 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 =

Re: Announcing PythonTurtle

2009-08-03 Thread Mensanator
On Aug 3, 8:18 am, cool-RR ram.rac...@gmail.com 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

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

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 mydevfor...@gmail.com 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

Re: easy_install: unresolved external symbol

2009-08-03 Thread Gabriel Genellina
En Mon, 03 Aug 2009 17:39:44 -0300, Bart Smeets bartsmeet...@gmail.com 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

Re: Ordering of dict keys values

2009-08-03 Thread Gabriel Genellina
En Mon, 03 Aug 2009 17:47:23 -0300, Wells Oliver we...@submute.net 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)' %

Re: Is python buffer overflow proof?

2009-08-03 Thread Gabriel Genellina
En Mon, 03 Aug 2009 18:04:53 -0300, sturlamolden sturlamol...@yahoo.no escribió: On 2 Aug, 15:50, Jizzai jiz...@gmail.com 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

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 cocobear...@gmail.com wrote: Thistwopngfile has their own palette im1.mode 'P' im.mode 'P' im.getpalette == im1.getpalette False I can use this code

Re: Announcing PythonTurtle

2009-08-03 Thread Asun Friere
On Aug 4, 6:35 am, r rt8...@gmail.com 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') --

Re: Seeding the rand() Generator

2009-08-03 Thread Fred Atkinson
On Sun, 2 Aug 2009 17:00:40 -0700 (PDT), Carl Banks pavlovevide...@gmail.com 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

[OT] Re: Ordering of dict keys values

2009-08-03 Thread Benjamin Kaplan
On Mon, Aug 3, 2009 at 9:18 PM, Gabriel Genellina gagsl-...@yahoo.com.ar 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

Re: RUBY vs COMMON LISP

2009-08-03 Thread fft1976
On Aug 3, 1:19 am, p...@informatimago.com (Pascal J. Bourguignon) wrote: fft1976 fft1...@gmail.com 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 da...@ieee.org wrote: snip 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

Re: Seeding the rand() Generator

2009-08-03 Thread Carl Banks
On Aug 3, 8:12 pm, Fred Atkinson fatkin...@mishmash.com wrote: On Sun, 2 Aug 2009 17:00:40 -0700 (PDT), Carl Banks pavlovevide...@gmail.com wrote:         I appreciate the response.           I am executing a statement to retrieve one record at random.           An example would be:

Re: RUBY vs COMMON LISP

2009-08-03 Thread Carl Banks
On Aug 3, 7:51 pm, fft1976 fft1...@gmail.com wrote: On Aug 3, 1:19 am, p...@informatimago.com (Pascal J. Bourguignon) wrote: fft1976 fft1...@gmail.com 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:

Re: RUBY vs COMMON LISP

2009-08-03 Thread fft1976
On Aug 3, 8:02 pm, Carl Banks pavlovevide...@gmail.com wrote: On Aug 3, 7:51 pm, fft1976 fft1...@gmail.com wrote: On Aug 3, 1:19 am, p...@informatimago.com (Pascal J. Bourguignon) wrote: fft1976 fft1...@gmail.com writes: By the way, here is in 1 line of BF, a complete BF reader

Re: file comparison

2009-08-03 Thread Dave Angel
learner learner wrote: Firstly thanks for showing the interest. I shall elobarate more on the problem: file-1.txt -- hai how r u file-2.txt --- r hai u The two files have some lines in common. For eg: File-1.txt-first line-hai does not match with File-2.txt-first

Re: no-clobber dicts?

2009-08-03 Thread Steven D'Aprano
On Mon, 03 Aug 2009 21:07:32 +, 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

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

2009-08-03 Thread Steven D'Aprano
On Mon, 03 Aug 2009 16:38:43 +0200, Jean-Michel Pichavant wrote: So what's the purpose of making from Module import factory as a from Module import factory as b return 2 different objects ? If I had to write this code I would expect 'a is b' to return 'True'. This is no don't do that

  1   2   >