ANN: ActivePython 3.1.0.1 is now available

2009-07-02 Thread Sridhar Ratnakumar
I'm happy to announce that ActivePython 3.1.0.1 is now available for download from: http://www.activestate.com/activepython/python3/ This is a major release that updates ActivePython3 to core Python 3.1. What is ActivePython? - ActivePython is ActiveState's binary

[ANN]: 'twander' Cross-Platform File Manager Version 3.231 Released And Available

2009-07-02 Thread Tim Daneliuk
'twander' Version 3.231 is now released and available for download at: http://www.tundraware.com/Software/twander The last public release was 3.224. This release fixes a number of bugs and adds a variety of useful new features. See the WHATSNEW.txt file for all the details.

Moovida Media Center 1.0.4 Release

2009-07-02 Thread Guillaume Emont
Dear Python users, The Moovida team is happy to announce the release of Moovida Media Center 1.0.4, code-named All That Matters. Moovida, formerly known as Elisa, is a cross-platform and open-source Media Center written in Python. It uses GStreamer [1] for media playback and pigment [2] to

Deadline for Toronto PyCamp Registraiton Appoaching

2009-07-02 Thread Chris Calloway
Tomorrow (July 3) by midnight will be the last opportunity for Toronto PyCamp registration before the late registration period ending July 10. PyCamp is the original Python BootCamp developed by a user group for user groups. This year PyCamp is July 13-17 at the University of Toronto, sponsored

Python Bootcamp - Last 3 weeks to Register (July 27-31, 2009)

2009-07-02 Thread Chander Ganesan
Just a reminder that there are only 3 weeks remaining to register for the Open Technology Group's Python Bootcamp, a 5 day hands-on, intensive, in-depth introduction to Python. This course is confirmed and guaranteed to run. Worried about the costs of air and hotel to travel for training?

Re: Basic question from pure beginner

2009-07-02 Thread alex23
Dennis Lee Bieber wlfr...@ix.netcom.com wrote:         There is also the getpass module to play with! I don't think I've ever seen getpass, so thanks for pointing that out. Unfortunately, it wouldn't have helped the OP understand why his original code wasn't working ;) --

Re: Accessing windows structures through ctypes.

2009-07-02 Thread Horace Blegg
http://www.codeproject.com/KB/threads/GetNtProcessInfo.aspx Looks rather to be pretty simple: Acquire the PED base pointer (article explains how) and then just read that information into a struct using ReadProcessMemory(). On Wed, Jul 1, 2009 at 10:42 PM, Rajat rajat.dud...@gmail.com wrote:

dealloc function in python extend c module

2009-07-02 Thread Shen, Yu-Teh
I create my extend type something like http://www.python.org/doc/current/extending/newtypes.html. And my type has a member which is a pointer point to my allocate memory ( no ref count). ex: --- typedef struct { PyObject_HEAD /*

Re: A question about fill_free_list(void) function

2009-07-02 Thread Pedram
On Jul 1, 10:01 pm, Christian Heimes li...@cheimes.de wrote: Pedram schrieb: Hello community, I'm reading the CPython interpreter source code, first, if you have something that I should know for better reading this source code, I would much appreciate that :) second, in intobject.c

wxPython: Plaing widgets in status bar

2009-07-02 Thread iu2
Hi all, I try to placs widgets (button, static text labels) in a status bar, wxPython. From the examples I could place them using exact positioning by the status bar methof GetFieldRect. In this case I need to add an EVT_SIZER handler to keep the widgets in their propotional places within the

Re: Accessing windows structures through ctypes.

2009-07-02 Thread alex23
On Jul 2, 3:42 pm, Rajat rajat.dud...@gmail.com wrote: Using ctypes can I access the windows structures like: PROCESS_INFORMATION_BLOCK, Process Environment Block(PEB), PEB_LDR_DATA, etc? ctypes.wintypes lists all of the Windows structures included with the module. You should be able to use

Re: pep 8 constants

2009-07-02 Thread Eric S. Johansson
Steven D'Aprano wrote: That assumes that every word is all caps. In practice, for real-life Python code, I've tripled the vocal load of perhaps one percent of your utterances, which cuts your productivity by 2%. If you have 1 words in you per day, and one percent get wrapped with a

Re: Accessing windows structures through ctypes.

2009-07-02 Thread Rajat
Using ctypes can I access the windows structures like: PROCESS_INFORMATION_BLOCK, Process Environment Block(PEB), PEB_LDR_DATA, etc? ctypes.wintypes lists all of the Windows structures included with the module. You should be able to use ctypes.Structure class to roll your own: Thanks

multiprocessing and freezing on Windows

2009-07-02 Thread SK
Is there a method for freezing a Python 2.6 app using multiprocessing on Windows using PyInstaller or py2exe that works? It is trying to call my executable instead of python.exe when the process starts and passes it --multiprocessing-fork . Adding a freeze_support() to my main doesn't help. Do I

Re: Open Source RSS Reader in Python?

2009-07-02 Thread Chris Rebert
On Wed, Jul 1, 2009 at 4:18 PM, Alexalex.lavoro.pro...@gmail.com wrote: I am looking for an open source RSS reader (desktop, not online) written in Python but in vain. I am not looking for a package but a fully functional software. Google: python open source (rss OR feeds) reader Any clue ?

Searching equivalent to C++ RAII or deterministic destructors

2009-07-02 Thread Ulrich Eckhardt
Hi! I'm currently converting my bioware to handle Python code and I have stumbled across a problem... Simple scenario: I have a handle to a resource. This handle allows me to manipulate the resource in various ways and it also represents ownership. Now, when I put this into a class, instances to

PEP368 and pixeliterators

2009-07-02 Thread Joachim Strömbergson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Aloha! I just read the PEP368 and really liked the proposed idea, sound like a great battery addition to include in the std lib: http://www.python.org/dev/peps/pep-0368/ One question/idea though: The proposed iterator will iterate over all pixels

Re: Determining if a function is a method of a class within a decorator

2009-07-02 Thread Jeremiah Dodds
On Wed, Jul 1, 2009 at 2:14 AM, David Hirschfield dav...@ilm.com wrote: Unfortunately that still requires two separate decorators, when I was hoping there was a way to determine if I was handed a function or method from within the same decorator. Seems like there really isn't, so two

Re: A question about fill_free_list(void) function

2009-07-02 Thread Peter Otten
Pedram wrote: On Jul 1, 10:01 pm, Christian Heimes li...@cheimes.de wrote: Pedram schrieb: Hello community, I'm reading the CPython interpreter source code, first, if you have something that I should know for better reading this source code, I would much appreciate that :) second, in

Need Help

2009-07-02 Thread Tengiz Davitadze
Hello. I can't find a wright mail address. If you can help me I need to get an information about UNICODE. I am georgian and I need to write programs on georgian language . If you can transfer this mail or send me a wright mail about encoding or unicode information. -- Tengiz Davitadze {

Re: deleting certain entries in numpy array

2009-07-02 Thread Sebastian Schabe
Robert Kern schrieb: First, convert the pos array to integers, and just the columns with indices in them: ipos = pos[:,:2].astype(int) Now check the values in the mask corresponding to these positions: mask_values = mask[ipos[:,0], ipos[:,1]] Now extract the rows from the original pos

Re: Searching equivalent to C++ RAII or deterministic destructors

2009-07-02 Thread Bearophile
Ulrich Eckhardt: a way to automatically release the resource, something which I would do in the destructor in C++. Is this helpful? http://effbot.org/pyref/with.htm Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Multi thread reading a file

2009-07-02 Thread Gabriel Genellina
En Wed, 01 Jul 2009 12:49:31 -0300, Scott David Daniels scott.dani...@acm.org escribió: Gabriel Genellina wrote: ... def convert(in_queue, out_queue): while True: row = in_queue.get() if row is None: break # ... convert row out_queue.put(converted_line) These loops work

Re: Searching equivalent to C++ RAII or deterministic destructors

2009-07-02 Thread Ulrich Eckhardt
Bearophile wrote: Ulrich Eckhardt: a way to automatically release the resource, something which I would do in the destructor in C++. Is this helpful? http://effbot.org/pyref/with.htm Yes, it aims in the same direction. However, I'm not sure this applies to my case. The point is that the

Re: Searching equivalent to C++ RAII or deterministic destructors

2009-07-02 Thread Peter Otten
Ulrich Eckhardt wrote: Bearophile wrote: Ulrich Eckhardt: a way to automatically release the resource, something which I would do in the destructor in C++. Is this helpful? http://effbot.org/pyref/with.htm Yes, it aims in the same direction. However, I'm not sure this applies to my

Re: A question about fill_free_list(void) function

2009-07-02 Thread Pedram
On Jul 2, 1:11 pm, Peter Otten __pete...@web.de wrote: Pedram wrote: On Jul 1, 10:01 pm, Christian Heimes li...@cheimes.de wrote: Pedram schrieb: Hello community, I'm reading the CPython interpreter source code, first, if you have something that I should know for better reading

performance problem with time.strptime()

2009-07-02 Thread Nils Rüttershoff
Hi everyone, In my free time I translate scripts from open source projects or write my own, to train my python skills. ATM I convert the aplogmerge.pl from awstats. It merges multiple apache logfiles and sort the output by the timestamps of each line. My first version of this script hasn't a

Re: Need Help

2009-07-02 Thread Simon Brunning
2009/7/2 Tengiz Davitadze davitadze.ten...@gmail.com: Hello. I can't find a wright mail address. If you can help me I need to get an information about UNICODE. I am georgian and I need to write programs on georgian language . If you can transfer this mail or send me a wright mail about

Re: performance problem with time.strptime()

2009-07-02 Thread Casey Webster
On Jul 2, 7:30 am, Nils Rüttershoff n...@ccsg.de wrote: Rec = re.compile(r^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\s-\s\d+\s\[(\d{2}/\w+/\d{4}:\d{2}:\d{2}:\d{2})\s\+\d{4}\].*) Line = '1.2.3.4 - 4459 [02/Jul/2009:01:50:26 +0200] GET /foo HTTP/1.0 200 - - www.example.org - - -' I'm not sure how much

Re: PEP 376

2009-07-02 Thread Tarek Ziadé
2009/7/2 Joachim Strömbergson joac...@strombergson.com: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Aloha! Richard Brodie wrote: Joachim Str�mbergson joac...@strombergson.com wrote in message news:mailman.2422.1246418400.8015.python-l...@python.org... Even so, choosing md5 in 2009 for

Re: Searching equivalent to C++ RAII or deterministic destructors

2009-07-02 Thread Dave Angel
Ulrich Eckhardt wrote: Hi! I'm currently converting my bioware to handle Python code and I have stumbled across a problem... Simple scenario: I have a handle to a resource. This handle allows me to manipulate the resource in various ways and it also represents ownership. Now, when I put this

Re: Why re.match()?

2009-07-02 Thread Hrvoje Niksic
kj no.em...@please.post writes: For a recovering Perl-head like me it is difficult to understand why Python's re module offers both match and search. Why not just use search with a beginning-of-string anchor? I need re.match when parsing the whole string. In that case I never want to search

Re: Searching equivalent to C++ RAII or deterministic destructors

2009-07-02 Thread Christian Heimes
Dave Angel wrote: Look also at 'del' a command in the language which explicitly deletes an object. No, you are either explaining it the wrong way or you have been fallen for a common misinterpretation of the del statement. The del statement only removes the object from the current scope. This

Re: PEP368 and pixeliterators

2009-07-02 Thread Casey Webster
On Jul 2, 4:32 am, Joachim Strömbergson joac...@strombergson.com wrote: But, wouldn't it be more Pythonic and simpler to have an iterator that iterates over all pixels in an image? Starting with upper left corner and moving left-right and (line by line) to lower right. This would change the

Re: Searching equivalent to C++ RAII or deterministic destructors

2009-07-02 Thread Peter Otten
Dave Angel wrote: But I'm guessing you want something that automatically deletes objects whenever the last reference disappears. That's an implementation detail, not a language guarantee. In particular CPython does what you want, by using reference counting. That's the only Python I've

Re: performance problem with time.strptime()

2009-07-02 Thread Nils Rüttershoff
Hi Casey Casey Webster wrote: On Jul 2, 7:30 am, Nils Rüttershoff n...@ccsg.de wrote: Rec = re.compile(r^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\s-\s\d+\s\[(\d{2}/\w+/\d{4}:\d{2}:\d{2}:\d{2})\s\+\d{4}\].*) Line = '1.2.3.4 - 4459 [02/Jul/2009:01:50:26 +0200] GET /foo HTTP/1.0 200 - -

Re: performance problem with time.strptime()

2009-07-02 Thread Dave Angel
Nils Rüttershoff wrote: Hi everyone, In my free time I translate scripts from open source projects or write my own, to train my python skills. ATM I convert the aplogmerge.pl from awstats. It merges multiple apache logfiles and sort the output by the timestamps of each line. My first version

Re: PEP 376

2009-07-02 Thread Joachim Strömbergson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Aloha! Tarek Ziadé wrote: The prefix is a good idea but since it's just a checksum to control that the file hasn't changed what's wrong with using a weak hash algorithm like md5 or now sha1 ? Because it creates a dependency to an old algorithm

Re: PEP368 and pixeliterators

2009-07-02 Thread Joachim Strömbergson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Aloha! Casey Webster wrote: Unless I'm totally misreading the PEP, the author does provide both iterators. Quoting the PEP: Non-planar images offer the following additional methods: pixels() - iterator[pixel] Returns an iterator that

Re: Re: Searching equivalent to C++ RAII or deterministic destructors

2009-07-02 Thread Dave Angel
Christian Heimes wrote: Dave Angel wrote: Look also at 'del' a command in the language which explicitly deletes an object. No, you are either explaining it the wrong way or you have been fallen for a common misinterpretation of the del statement. The del statement only removes the

Re: Trying to use sets for random selection, but the pop() method returns items in order

2009-07-02 Thread Mario Garcia
This could be better: import random population = range(10) choice = random.choice(population) population.remove(choice) print population print population [0, 1, 2, 3, 4, 5, 6, 8, 9] That was my idea with the previous pop(), remove from the population a certain number of elements at

Re: pep 8 constants

2009-07-02 Thread Lie Ryan
Eric S. Johansson wrote: Steven D'Aprano wrote: That assumes that every word is all caps. In practice, for real-life Python code, I've tripled the vocal load of perhaps one percent of your utterances, which cuts your productivity by 2%. If you have 1 words in you per day, and one

Re: pep 8 constants

2009-07-02 Thread Lie Ryan
Eric S. Johansson wrote: I've been working with speech recognition for 15 years. I've written something on the order of 10,000 lines of Python code both as open source and private projects. I've tried it least two dozen editors and they all fail miserably because they're focused on keyboard

Re: Timeout when connecting to sybase DBS

2009-07-02 Thread eranlevi
On Jul 2, 1:08 am, s...@pobox.com wrote:     Gil There's no such group as python-sybase :-( http://sourceforge.net/mailarchive/forum.php?forum_name=python-sybase... S Thanks :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Timeout when connecting to sybase DBS

2009-07-02 Thread eranlevi
On Jul 2, 1:07 am, s...@pobox.com wrote:     Gil Are you saying, that when you trying to connect to a sybase DBS     Gil server and the DBS or the server is down, you get an error after a     Gil few seconds and not after a few minutes? Yes, though thankfully our server tends to almost always

Re: PEP368 and pixeliterators

2009-07-02 Thread Nobody
On Thu, 02 Jul 2009 10:32:04 +0200, Joachim Strömbergson wrote: I just read the PEP368 and really liked the proposed idea, sound like a great battery addition to include in the std lib: http://www.python.org/dev/peps/pep-0368/ Unfortunately, it's too simplistic, meaning that most of the

Re: Idioms and Anti-Idioms Question

2009-07-02 Thread J. Cliff Dyer
On Wed, 2009-07-01 at 17:19 +1200, Lawrence D'Oliveiro wrote: In message mailman.2018.1245772229.8015.python-l...@python.org, J. Cliff Dyer wrote: If the lines got separated, a leading + could disappear into its line without any errors showing up. A trailing + would raise a syntax error.

Re: Spam? Re: whizBase vs. Python

2009-07-02 Thread Nils Rüttershoff
NurAzije wrote: On Jun 29, 11:04 am, Tim Harig user...@ilthio.net wrote: On 2009-06-29, NurAzije nuraz...@gmail.com wrote: Hi, I am working on a study and I need expert opinion, I did not work with Python before, can anyone help me with a comparison betweenWhizBase

logging of strings with broken encoding

2009-07-02 Thread Thomas Guettler
Hi, I have bug in my code, which results in the same error has this one: https://bugs.launchpad.net/bzr/+bug/295653 {{{ Traceback (most recent call last): File /usr/lib/python2.6/logging/__init__.py, line 765, in emit self.stream.write(fs % msg.encode(UTF-8)) .. UnicodeDecodeError:

multiprocessing: pool with blocking queue

2009-07-02 Thread masher
Hi, I am trying to implement a multiprocessing pool that assigns tasks from a blocking queue. My situation is a pretty classic producer/ consumer conundrum, where the producer can produce much faster than the consumers can consume. The wrinkle in the story is that the producer produces objects

Re: logging of strings with broken encoding

2009-07-02 Thread David Smith
Thomas Guettler wrote: Hi, I have bug in my code, which results in the same error has this one: https://bugs.launchpad.net/bzr/+bug/295653 {{{ Traceback (most recent call last): File /usr/lib/python2.6/logging/__init__.py, line 765, in emit self.stream.write(fs %

Re: logging of strings with broken encoding

2009-07-02 Thread Peter Otten
Thomas Guettler wrote: I have bug in my code, which results in the same error has this one: https://bugs.launchpad.net/bzr/+bug/295653 {{{ Traceback (most recent call last): File /usr/lib/python2.6/logging/__init__.py, line 765, in emit self.stream.write(fs % msg.encode(UTF-8))

MySQLdb and ordering of column names in list returned by keys() w/ a DictCursor

2009-07-02 Thread Wells Oliver
Is there some kind of mysterious logic to how the the columns are ordered when executing the following: sql = SELECT player_id, SUM(K) AS K, SUM(IP) AS IP, SUM(ER) AS ER, SUM(HR) AS HR, SUM(H) AS H, SUM(BB) AS BB, Teams.league FROM Pitching INNER JOIN Teams ON Pitching.team = Teams.team_id WHERE

Re: MySQLdb and ordering of column names in list returned by keys() w/ a DictCursor

2009-07-02 Thread Tim Chase
sql = SELECT player_id, SUM(K) AS K, SUM(IP) AS IP, SUM(ER) AS ER, SUM(HR) AS HR, SUM(H) AS H, SUM(BB) AS BB, Teams.league FROM Pitching INNER JOIN Teams ON Pitching.team = Teams.team_id WHERE Date BETWEEN '%s' AND '%s' GROUP BY player_id % (start, date) cursor.execute(sql) for row in

Re: logging of strings with broken encoding

2009-07-02 Thread Lie Ryan
Thomas Guettler wrote: Hi, I have bug in my code, which results in the same error has this one: https://bugs.launchpad.net/bzr/+bug/295653 {{{ Traceback (most recent call last): File /usr/lib/python2.6/logging/__init__.py, line 765, in emit self.stream.write(fs %

Re: logging of strings with broken encoding

2009-07-02 Thread Thomas Guettler
My quick fix is this: class MyFormatter(logging.Formatter): def format(self, record): msg=logging.Formatter.format(self, record) if isinstance(msg, str): msg=msg.decode('utf8', 'replace') return msg But I still think handling of non-ascii byte strings

Re: MySQLdb and ordering of column names in list returned by keys() w/ a DictCursor

2009-07-02 Thread Wells Oliver
Will this order at least be the same for that same query every time the script is executed? On Thu, Jul 2, 2009 at 10:48 AM, Tim Chase python.l...@tim.thechases.comwrote: sql = SELECT player_id, SUM(K) AS K, SUM(IP) AS IP, SUM(ER) AS ER, SUM(HR) AS HR, SUM(H) AS H, SUM(BB) AS BB, Teams.league

Re: multiprocessing: pool with blocking queue

2009-07-02 Thread J Kenneth King
masher vertesp...@gmail.com writes: My questions, then, is: Is there a more elegant/pythonic way of doing what I am trying to do with the current Pool class? Forgive me, I may not fully understand what you are trying to do here (I've never really used multiprocessing all that much)... But

Re: deleting certain entries in numpy array

2009-07-02 Thread Robert Kern
On 2009-07-02 04:40, Sebastian Schabe wrote: Robert Kern schrieb: You will want to ask numpy questions on the numpy mailing list. http://www.scipy.org/Mailing_Lists I ever thought news-groups are the right way for questions like this. And the mailing list page just confuses me, but

Re: multiprocessing: pool with blocking queue

2009-07-02 Thread masher
On Jul 2, 12:06 pm, J Kenneth King ja...@agentultra.com wrote: masher vertesp...@gmail.com writes: My questions, then, is: Is there a more elegant/pythonic way of doing what I am trying to do with the current Pool class? Forgive me, I may not fully understand what you are trying to do here

Dict ordering [was: Re: MySQLdb and ordering of column names in list returned by keys() w/ a DictCursor]

2009-07-02 Thread Tim Wintle
On Thu, 2009-07-02 at 10:32 -0500, Wells Oliver wrote: for row in cursor.fetchall(): print row.keys() What I get is: ['league', 'BB', 'HR', 'IP', 'K', 'H', 'player_id', 'ER'] Neither alphabetical nor the order in which they were specified in the query nor... any seeming order I can

Re: MySQLdb and ordering of column names in list returned by keys() w/ a DictCursor

2009-07-02 Thread Tim Chase
Will this order at least be the same for that same query every time the script is executed? I wouldn't count on it. The order is only defined for the one iteration (result of the keys() call). If the order matters, I'd suggest a double-dispatch with a non-dict (regular/default) query

regex question on .findall and \b

2009-07-02 Thread Ethan Furman
Greetings! My closest to successfull attempt: Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] Type copyright, credits or license for more information. IPython 0.9.1 -- An enhanced Interactive Python. In [161]: re.findall('\d+','this is test a3 attempt 79')

Re: logging of strings with broken encoding

2009-07-02 Thread Stefan Behnel
Thomas Guettler wrote: My quick fix is this: class MyFormatter(logging.Formatter): def format(self, record): msg=logging.Formatter.format(self, record) if isinstance(msg, str): msg=msg.decode('utf8', 'replace') return msg But I still think

Re: regex question on .findall and \b

2009-07-02 Thread Tim Chase
Ethan Furman wrote: Greetings! My closest to successfull attempt: Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] Type copyright, credits or license for more information. IPython 0.9.1 -- An enhanced Interactive Python. In [161]: re.findall('\d+','this is test

Re: logging of strings with broken encoding

2009-07-02 Thread Lie Ryan
Thomas Guettler wrote: My quick fix is this: class MyFormatter(logging.Formatter): def format(self, record): msg=logging.Formatter.format(self, record) if isinstance(msg, str): msg=msg.decode('utf8', 'replace') return msg But I still think

Re: invoking a method from two superclasses

2009-07-02 Thread Lie Ryan
Carl Banks wrote: On Jun 30, 6:23 pm, Carl Banks pavlovevide...@gmail.com wrote: On Jun 30, 5:34 pm, Mitchell L Model mlmli...@comcast.net wrote: Allow me to add to my previous question that certainly the superclass methods can be called explicitly without resorting to super(), e.g.:

Re: dealloc function in python extend c module

2009-07-02 Thread Philip Semanchuk
On Jul 2, 2009, at 2:11 AM, Shen, Yu-Teh wrote: I create my extend type something like http://www.python.org/doc/current/extending/newtypes.html . And my type has a member which is a pointer point to my allocate memory ( no ref count). ex: ---

question of style

2009-07-02 Thread Simon Forman
Hey I was hoping to get your opinions on a sort of minor stylistic point. These two snippets of code are functionally identical. Which would you use and why? The first one is easier [for me anyway] to read and understand, but slightly less efficient, while the second is [marginally] harder to

Re: regex question on .findall and \b

2009-07-02 Thread Sjoerd Mullender
On 2009-07-02 18:38, Ethan Furman wrote: Greetings! My closest to successfull attempt: Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] Type copyright, credits or license for more information. IPython 0.9.1 -- An enhanced Interactive Python. In [161]:

Re: Direct interaction with subprocess - the curse of blocking I/O

2009-07-02 Thread Pascal Chambon
Thank you all for the comments you might want something like Expect. Yes Expect deals with such things, unfortunately it's posix only (due to the PTY module requirement...); whereas I'd like to find generic ways (i.e at least windows/linux/mac recipes) The latter is inherently tricky

Re: PEP 376

2009-07-02 Thread Lie Ryan
Joachim Strömbergson wrote: Aloha! Tarek Ziadé wrote: The prefix is a good idea but since it's just a checksum to control that the file hasn't changed what's wrong with using a weak hash algorithm like md5 or now sha1 ? Because it creates a dependency to an old algorithm that should be

Re: question of style

2009-07-02 Thread Duncan Booth
Simon Forman sajmik...@gmail.com wrote: Hey I was hoping to get your opinions on a sort of minor stylistic point. These two snippets of code are functionally identical. Which would you use and why? The first one is easier [for me anyway] to read and understand, but slightly less efficient,

Re: MySQLdb and ordering of column names in list returned by keys() w/ a DictCursor

2009-07-02 Thread Petr Messner
2009/7/2 Tim Chase python.l...@tim.thechases.com: Will this order at least be the same for that same query every time the script is executed? I wouldn't count on it. The order is only defined for the one iteration (result of the keys() call). If the order matters, I'd suggest a

Config files with different types

2009-07-02 Thread Zach Hobesh
Hi all, I've written a function that reads a specifically formatted text file and spits out a dictionary.  Here's an example: config.txt: Destination = C:/Destination Overwrite = True Here's my function that takes 1 argument (text file) the_file = open(textfile,'r') linelist =

Re: Suppressing Implicit Chained Exceptions (Python 3.0)

2009-07-02 Thread David Bolen
andrew cooke and...@acooke.org writes: However, when printed via format_exc(), this new exception still has the old exception attached via the mechanism described at http://www.python.org/dev/peps/pep-3134/ (this is Python 3.0). If you're in control of the format_exc() call, I think the new

Re: question of style

2009-07-02 Thread Simon Forman
On Jul 2, 1:44 pm, Duncan Booth duncan.bo...@invalid.invalid wrote: Simon Forman sajmik...@gmail.com wrote: Hey I was hoping to get your opinions on a sort of minor stylistic point. These two snippets of code are functionally identical. Which would you use and why? The first one is

Re: PEP 376

2009-07-02 Thread Charles Yeomans
On Jul 2, 2009, at 1:37 PM, Lie Ryan wrote: Joachim Strömbergson wrote: Aloha! Tarek Ziadé wrote: The prefix is a good idea but since it's just a checksum to control that the file hasn't changed what's wrong with using a weak hash algorithm like md5 or now sha1 ? Because it creates a

Re: Config files with different types

2009-07-02 Thread MRAB
Zach Hobesh wrote: Hi all, I've written a function that reads a specifically formatted text file and spits out a dictionary. Here's an example: config.txt: Destination = C:/Destination Overwrite = True Here's my function that takes 1 argument (text file) the_file = open(textfile,'r')

Re: question of style

2009-07-02 Thread Kee Nethery
the fact that you felt compelled to explain the one minor point in the first snippet tells me that the second snippet does not need that explanation and will be easier for someone (like you for example) to maintain in the future. Second snippet would be my choice. Kee Nethery On Jul 2,

Re: Searching equivalent to C++ RAII or deterministic destructors

2009-07-02 Thread Carl Banks
On Jul 2, 3:12 am, Ulrich Eckhardt eckha...@satorlaser.com wrote: Bearophile wrote: Ulrich Eckhardt: a way to automatically release the resource, something which I would do in the destructor in C++. Is this helpful? http://effbot.org/pyref/with.htm Yes, it aims in the same direction.

Re: regex question on .findall and \b

2009-07-02 Thread Nobody
On Thu, 02 Jul 2009 09:38:56 -0700, Ethan Furman wrote: Greetings! My closest to successfull attempt: Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] Type copyright, credits or license for more information. IPython 0.9.1 -- An enhanced Interactive Python.

Re: question of style

2009-07-02 Thread Terry Reedy
Simon Forman wrote: Hey I was hoping to get your opinions on a sort of minor stylistic point. These two snippets of code are functionally identical. Which would you use and why? The first one is easier [for me anyway] to read and understand, but slightly less efficient, while the second is

Re: multiprocessing: pool with blocking queue

2009-07-02 Thread J Kenneth King
masher vertesp...@gmail.com writes: On Jul 2, 12:06 pm, J Kenneth King ja...@agentultra.com wrote: masher vertesp...@gmail.com writes: My questions, then, is: Is there a more elegant/pythonic way of doing what I am trying to do with the current Pool class? Forgive me, I may not fully

Re: Suppressing Implicit Chained Exceptions (Python 3.0)

2009-07-02 Thread andrew cooke
David Bolen wrote: andrew cooke and...@acooke.org writes: However, when printed via format_exc(), this new exception still has the old exception attached via the mechanism described at http://www.python.org/dev/peps/pep-3134/ (this is Python 3.0). If you're in control of the format_exc()

Re: Open Source RSS Reader in Python?

2009-07-02 Thread member thudfoo
On Wed, Jul 1, 2009 at 4:18 PM, Alexalex.lavoro.pro...@gmail.com wrote: I am looking for an open source RSS reader (desktop, not online) written in Python but in vain. I am not looking for a package but a fully functional software. Google: python open source (rss OR feeds) reader Any clue ?

Re: question of style

2009-07-02 Thread Paul Rubin
Simon Forman sajmik...@gmail.com writes: These two snippets of code are functionally identical. Which would you use and why? Both are terrible. I can't tell what you're really trying to do. As Terry Reedy points out, the case where self.higher and self.lower are both not None is not handled.

Re: question of style

2009-07-02 Thread Tim Harig
On 2009-07-02, Duncan Booth duncan.bo...@invalid.invalid wrote: so apart from reversing the order of the comparisons once you've dropped the redundant test it is the same as the first one. I try to evaluate what you have given regardless of what Booth pointed out. So, I will only evaluate the

Deadline for Toronto PyCamp Registraiton Appoaching

2009-07-02 Thread Chris Calloway
Tomorrow (July 3) by midnight will be the last opportunity for Toronto PyCamp registration before the late registration period ending July 10. PyCamp is the original Python BootCamp developed by a user group for user groups. This year PyCamp is July 13-17 at the University of Toronto, sponsored

Intro to Python class, 7/21-23, Ft Worth TX

2009-07-02 Thread Rich Drehoff
We are looking for someone that can help with the subject class, Intro to Python class, 7/21-23, Ft Worth TX. Please let me know if you can help. Would need your resume and best possible daily rate. Best regards, Rich Drehoff TechnoTraining, Inc. 328 Office Square Lane, Ste. 202,

Re: question of style

2009-07-02 Thread Scott David Daniels
Duncan Booth wrote: Simon Forman sajmik...@gmail.com wrote: ... if self.higher is self.lower is None: return ... As a matter of style however I wouldn't use the shorthand to run two 'is' comparisons together, I'd write that out in full if it was actually needed here. Speaking only to the

Re: question of style

2009-07-02 Thread Paul Rubin
Simon Forman sajmik...@gmail.com writes: ## Second snippet if self.higher is None: if self.lower is None: return return self.lower if self.lower is None: return self.higher What do you think? I'm not sure, but my guess is that what you are really trying to write is

how to spawn a process under different user

2009-07-02 Thread sanket
Hello All, I am trying to use python's subprocess module to launch a process. but in order to do that I have to change the user. I am not getting any clue how to do that? so can anyone please tell me How can I spawn a process under different user than currently I am logging in as. Thank you,

stringio+tarfile

2009-07-02 Thread superpollo
why the following does not work? can you help me correct (if possible)? 1 import tarfile 2 import StringIO 3 sf1 = StringIO.StringIO(one\n) 4 sf2 = StringIO.StringIO(two\n) 5 tf = StringIO.StringIO() 6 tar = tarfile.open(tf , w) 7 for name in [sf1 ,

Re: Searching equivalent to C++ RAII or deterministic destructors

2009-07-02 Thread Roel Schroeven
Peter Otten schreef: Ulrich Eckhardt wrote: Bearophile wrote: Ulrich Eckhardt: a way to automatically release the resource, something which I would do in the destructor in C++. Is this helpful? http://effbot.org/pyref/with.htm Yes, it aims in the same direction. However, I'm not sure

Re: question of style

2009-07-02 Thread Paul Rubin
Tim Harig user...@ilthio.net writes: If lower is 5 and higher is 3, then it returns 3 because 3 != None in the first if. Sorry, the presumption was that lower = higher, i.e. the comparison had already been made and the invariant was enforced by the class constructor. The comment should have

Re: how to spawn a process under different user

2009-07-02 Thread sanket
On Jul 2, 1:58 pm, Tim Golden m...@timgolden.me.uk wrote: sanket wrote: Hello All, I am trying to use python's subprocess module to launch a process. but in order to do that I have to change the user. I am not getting any clue how to do that? so can anyone please tell me How can I

String to List Question

2009-07-02 Thread Hanna Michelsen
Hi, I am brand new to python and I love it, but I've been having some trouble with a file parser that I've been working on. It contains lines that start with a name and then continue with names, nicknames and phone numbers of people associated with that name. I need to create a list of the names

XML(JSON?)-over-HTTP: How to define API?

2009-07-02 Thread Allen Fowler
I have an (in-development) python system that needs to shuttle events / requests around over the network to other parts of itself. It will also need to cooperate with a .net application running on yet a different machine. So, naturally I figured some sort of HTTP event / RPC type of would be

Re: String to List Question

2009-07-02 Thread Philip Semanchuk
On Jul 2, 2009, at 6:05 PM, Hanna Michelsen wrote: Hi, I am brand new to python and I love it, but I've been having some trouble with a file parser that I've been working on. It contains lines that start with a name and then continue with names, nicknames and phone numbers of people

  1   2   3   >