[ANN] BPT (Boxed Package Tool)

2009-04-30 Thread Giuseppe Ottaviano
Hi all, I am pleased to announce BPT 0.2a (despite the number, this is the first public version). http://pypi.python.org/pypi/bpt Like virtualenv, BPT allows to create isolate environments, but it is not limited to Python software, as it can be used to install arbitrary Unix software. It

Pyowa Meeting Next Monday

2009-04-30 Thread Mike Driscoll
Driscoll Pyowa Organizer www.pyowa.org twitter.com/pyowa __ Information from ESET NOD32 Antivirus, version of virus signature database 4046 (20090430) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com -- http://mail.python.org/mailman/listinfo/python

ANN: python-ldap-2.3.8

2009-04-30 Thread Michael Ströder
Find a new release of python-ldap: http://www.python-ldap.org/ python-ldap provides an object-oriented API to access LDAP directory servers from Python programs. It mainly wraps the OpenLDAP 2.x libs for that purpose. Additionally it contains modules for other LDAP-related stuff (e.g.

Re: ctypes

2009-04-30 Thread Lawrence D'Oliveiro
In message mailman.4805.1241051447.11746.python-l...@python.org, Gabriel Genellina wrote: c_float_p = ctypes.POINTER(ctypes.c_float) c_short_p = ctypes.POINTER(ctypes.c_short) I like to do import ctypes as ct to shorten the references: c_float_p = ct.POINTER(ct.c_float)

Re: Python SocketServer with IPv6

2009-04-30 Thread Martin v. Löwis
I am working on a overlay network implementation with python. I need to use both IPv4 and IPv6 at each node. Python socketserver is being used for this task. can anybody pls suggest me how to input an IPv6 address to the socketserver. I'm not quite sure I understand the question, so here is a

Re: import and package confusion

2009-04-30 Thread alex23
On Apr 30, 1:10 pm, Dale Amon a...@vnl.com wrote: I do not really see any other way to do what I want. If there is a way to get rid of the exec in the sample code I have used, I would love to know... but I can't see how to import something where part of the name comes from user command line

Re: telnetlib in python-3.0

2009-04-30 Thread Jack Diederich
On Wed, Apr 29, 2009 at 11:31 PM, rowl...@river2sea.org wrote: Is anyone using telnetlib in python-3.0? If so are you having any success? Using the example at the bottom of the telnetlib doc page I cannot seem to get any joy at all. I can make a connection, but write (command) seems to do

Re: import and package confusion

2009-04-30 Thread Arnaud Delobelle
Dale Amon a...@vnl.com writes: I do not really see any other way to do what I want. If there is a way to get rid of the exec in the sample code I have used, I would love to know... but I can't see how to import something where part of the name comes from user command line input without

Re: import and package confusion

2009-04-30 Thread Jeroen Ruigrok van der Werven
-On [20090430 02:21], Dale Amon (a...@vnl.com) wrote: import sys sys.path.extend (['../lib', '../bin']) from VLMLegacy.CardReader import CardReader rdr = CardReader (../example/B767.dat,PRINTABLE) iotypes = [WINGTL,VLMPC,VLM4997] for iotype in iotypes: packagename = VLMLegacy

Re: import and package confusion

2009-04-30 Thread Dave Angel
Dale Amon wrote: On Wed, Apr 29, 2009 at 10:02:46PM -0400, Dave Angel wrote: The dot syntax works very predictably, and quite flexibly. The problem was that by using the same name for module and class, you didn't realize you needed to include both. It is one of the hazards of

Re: dict is really slow for big truck

2009-04-30 Thread Bruno Desthuilliers
bearophileh...@lycos.com a écrit : Sion Arrowsmith: The keys aren't integers, though, they're strings. You are right, sorry. I need to add an int() there. Which is not garanteed to speed up the code FWIW -- http://mail.python.org/mailman/listinfo/python-list

Re: import and package confusion

2009-04-30 Thread Gabriel Genellina
En Thu, 30 Apr 2009 03:04:40 -0300, alex23 wuwe...@gmail.com escribió: On Apr 30, 1:10 pm, Dale Amon a...@vnl.com wrote: I do not really see any other way to do what I want. If there is a way to get rid of the exec in the sample code I have used, I would love to know... but I can't see how to

Re: Geohashing

2009-04-30 Thread Marco Mariani
norseman wrote: The posting needs (its creation) ... DATE. ... The code needs to state OS and program and version used to write it. And from there - user beware. Which would reduce the confusion greatly. I got the same error message and decided it was from an incompatible version, using

Re: dict is really slow for big truck

2009-04-30 Thread Bruno Desthuilliers
forrest yang a écrit : i try to load a big file into a dict, which is about 9,000,000 lines, something like 1 2 3 4 2 2 3 4 3 4 5 6 How like is it ?-) code for line in open(file) arr=line.strip().split('\t') dict[arr[0]]=arr but, the dict is really slow as i load more data into the

Re: Python Noob - a couple questions involving a web app

2009-04-30 Thread Bruno Desthuilliers
David Smith a écrit : Kyle T. Jones wrote: (snip question and answers recommending Django) Thanks everyone! Wow, pretty much a consensus - a rarity with these types of questions, at least in my experience. Ok, sounds like I need to be looking at Django. Thanks for the advice! Cheers!

Re: Tools for web applications

2009-04-30 Thread Marco Mariani
Mario wrote: I used JCreator LE, java IDE for windows because, when I add documentation of some new library, I have it on a F1 and index. So how you manage documentation and code completion ? I asume that you are geek but not even geeks could know every method of every class. What you call

Re: bug with os.rename in 2.4.1?

2009-04-30 Thread Nick Craig-Wood
Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Tue, 28 Apr 2009 14:30:02 -0500, Nick Craig-Wood wrote: t123 tom.lu...@gmail.com wrote: It's running on solaris 9. Here is some of the code. It's actually at the beginning of the job. The files are ftp'd over. The

Re: wxPython menu creation refactoring

2009-04-30 Thread Nick Craig-Wood
alex ale...@bluewin.ch wrote: I am still trying to refactor a simple GUI basing on an example in wxPython In Action, Listing 5.5 A refactored example where the menue creation is automatized. I understand the problem (each second for loop in def createMenuData (self) creates a distinct

Re: What do you think of ShowMeDo

2009-04-30 Thread Astley Le Jasper
Gosh ... it's all gone quite busy about logging in, gui etc. Certainly, I would try to make it clearer what is free and what isn't. But flash ... using that doesn't bother me. Loggin in ... fine ... I don't care as long as it's quick and there is something I might want. i just wanted to know if

Re: regular expression, unicode

2009-04-30 Thread Simon Strobl
Thanks for your hints. Usually, all my files are utf-8. Obviously, I somehow managed to inadvertently switch the encoding when creating this specific file. I have no idea how this could happen. Simon -- http://mail.python.org/mailman/listinfo/python-list

Measure the memory cost in Python

2009-04-30 Thread Li Wang
Hi everyone: I want to measure the actual memory cost of a particular step in my program (Python program), does anyone know if there is some function in Python could help me to do this job? Or should I seek other tools to help me? Thank you very much! -- Li -- Time is all we have and you

print(f) for files .. and is print % going away?

2009-04-30 Thread Esmail
Hello all, I use the print method with % for formatting my output to the console since I am quite familiar with printf from my C days, and I like it quite well. I am wondering if there is a way to use print to write formatted output to files? Also, it seems like I read that formatting with

Re: Dictionary, integer compression

2009-04-30 Thread dineshv
Yes, integer compression as in Unary, Golomb, and there are a few other schemes. It is known that for large (integer) data sets, encoding and decoding the integers will save space (memory and/or storage) and doesn't impact performance. As the Python dictionary is a built-in (and an important

Please explain this strange Python behaviour

2009-04-30 Thread Train Bwister
Please explain: http://python.pastebin.com/m401cf94d IMHO this behaviour is anything but the usual straight forward and obvious way of Python. Can you please point out the benefits of this behaviour? All the best, TrainBwister -- http://mail.python.org/mailman/listinfo/python-list

Re: print(f) for files .. and is print % going away?

2009-04-30 Thread Duncan Booth
Esmail ebo...@hotmail.com wrote: Hello all, I use the print method with % for formatting my output to the console since I am quite familiar with printf from my C days, and I like it quite well. I am wondering if there is a way to use print to write formatted output to files? Run python

Re: Please explain this strange Python behaviour

2009-04-30 Thread Diez B. Roggisch
Train Bwister wrote: Please explain: http://python.pastebin.com/m401cf94d IMHO this behaviour is anything but the usual straight forward and obvious way of Python. Can you please point out the benefits of this behaviour?

unbinding a global variable in Python

2009-04-30 Thread Mark Tarver
In Lisp this is done so (setq *g* 0) 0 *g* 0 (makunbound '*g*) *g* *g* error: unbound variable How is this done in Python? Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary, integer compression

2009-04-30 Thread bearophileHUGS
dineshv: Yes, integer compression as in Unary, Golomb, and there are a few other schemes. OK. Currently Python doesn't uses Golomb and similar compression schemes. But in Python3 all integers are multi-precision ones (I don't know yet what's bad with the design of Python2.6 integers), and a

Re: unbinding a global variable in Python

2009-04-30 Thread Diez B. Roggisch
Mark Tarver wrote: In Lisp this is done so (setq *g* 0) 0 *g* 0 (makunbound '*g*) *g* *g* error: unbound variable How is this done in Python? Mark foo = bar del foo foo Traceback (most recent call last): File stdin, line 1, in module NameError: name 'foo' is not

Re: unbinding a global variable in Python

2009-04-30 Thread Mark Tarver
On 30 Apr, 12:36, Diez B. Roggisch de...@nospam.web.de wrote: Mark Tarver wrote: In Lisp this is done so (setq *g* 0) 0 *g* 0 (makunbound '*g*) *g* *g* error: unbound variable How is this done in Python? Mark foo = bar del foo foo Traceback (most recent call

Re: Please explain this strange Python behaviour

2009-04-30 Thread Tim Chase
Train Bwister wrote: Please explain: http://python.pastebin.com/m401cf94d IMHO this behaviour is anything but the usual straight forward and obvious way of Python. Can you please point out the benefits of this behaviour?

Re: Dictionary, integer compression

2009-04-30 Thread Diez B. Roggisch
dineshv wrote: Yes, integer compression as in Unary, Golomb, and there are a few other schemes. It is known that for large (integer) data sets, encoding and decoding the integers will save space (memory and/or storage) and doesn't impact performance. As the Python dictionary is a

Re: Python SocketServer with IPv6

2009-04-30 Thread godshorse
On Apr 30, 1:02 pm, Martin v. Löwis mar...@v.loewis.de wrote: I am working on a overlay network implementation with python. I need to use both IPv4 and IPv6 at each node. Python socketserver is being used for this task. can anybody pls suggest me how to input an IPv6 address to the

Re: Python servlet for Java applet ?

2009-04-30 Thread Piet van Oostrum
Linuxguy123 linuxguy...@gmail.com (L) wrote: L On Sat, 2009-04-25 at 02:00 +0200, Piet van Oostrum wrote: Linuxguy123 linuxguy...@gmail.com (L) wrote: L Hi guys. L Is there a way to use a python application as the back end (ie rpc) for L a Java based applet ? Yes, you can use Corba,

Re: unbinding a global variable in Python

2009-04-30 Thread Duncan Booth
Mark Tarver dr.mtar...@ukonline.co.uk wrote: Great; and how can I test to see if a global is bound? e.g Lisp (setq *g* 0) 0 (boundp '*g*) t By trying to access it and catching the NameError exception if it isn't defined. -- Duncan Booth http://kupuguy.blogspot.com --

Re: Please explain this strange Python behaviour

2009-04-30 Thread Tim Chase
Duncan Booth wrote: Tim Chase python.l...@tim.thechases.com wrote: There _are_ cases where it's a useful behavior, but they're rare, so I don't advocate getting rid of it. But it is enough of a beginner gotcha that it really should be in the Python FAQ at www.python.org/doc/faq/general/

Re: Please explain this strange Python behaviour

2009-04-30 Thread Duncan Booth
Tim Chase python.l...@tim.thechases.com wrote: There _are_ cases where it's a useful behavior, but they're rare, so I don't advocate getting rid of it. But it is enough of a beginner gotcha that it really should be in the Python FAQ at www.python.org/doc/faq/general/ That's an

Re: print(f) for files .. and is print % going away?

2009-04-30 Thread Esmail
Matt Nordhoff wrote: Esmail wrote: Hello all, I use the print method with % for formatting my output to the console since I am quite familiar with printf from my C days, and I like it quite well. I am wondering if there is a way to use print to write formatted output to files? Also, it seems

Re: print(f) for files .. and is print % going away?

2009-04-30 Thread Esmail
Hi Duncan, Thanks for the information, I'll dig deeper :-) (for some reason I can't get the from __future__ import to work, from __future__ import print_function File stdin, line 1 SyntaxError: future feature print_function is not defined but I am probably making some silly mistake, plus

Re: print(f) for files .. and is print % going away?

2009-04-30 Thread Duncan Booth
Esmail ebo...@hotmail.com wrote: (for some reason I can't get the from __future__ import to work, from __future__ import print_function File stdin, line 1 SyntaxError: future feature print_function is not defined but I am probably making some silly mistake, plus I have been

Re: print(f) for files .. and is print % going away?

2009-04-30 Thread Matt Nordhoff
Esmail wrote: Hello all, I use the print method with % for formatting my output to the console since I am quite familiar with printf from my C days, and I like it quite well. I am wondering if there is a way to use print to write formatted output to files? Also, it seems like I read

Re: multiprocessing, pool and process crashes

2009-04-30 Thread Jesse Noller
On Wed, Apr 29, 2009 at 10:50 AM, drag...@gmail.com wrote: I want to use the multiprocessing.Pool object to run multiple tasks in separate processes. The problem is that I want to call an external C function (from a shared library, with help from ctypes) and this function tends to crash

Re: print(f) for files .. and is print % going away?

2009-04-30 Thread Esmail
Duncan Booth wrote: Esmail ebo...@hotmail.com wrote: (for some reason I can't get the from __future__ import to work, You can only use the print function on 2.6 and later. If you have an older version of Python then you'll get that error. Ooops, yes, you wrote that and I tried with 2.6

Re: Multiprocessing Pool and functions with many arguments

2009-04-30 Thread Jesse Noller
On Wed, Apr 29, 2009 at 2:01 PM, psaff...@googlemail.com psaff...@googlemail.com wrote: I'm trying to get to grips with the multiprocessing module, having only used ParallelPython before. based on this example: http://docs.python.org/library/multiprocessing.html#using-a-pool-of-workers

Re: unbinding a global variable in Python

2009-04-30 Thread Hrvoje Niksic
Mark Tarver dr.mtar...@ukonline.co.uk writes: (setq *g* 0) 0 (boundp '*g*) t 'foo' in globals() -- http://mail.python.org/mailman/listinfo/python-list

Re: unbinding a global variable in Python

2009-04-30 Thread Peter Otten
Mark Tarver wrote: In Lisp this is done so (setq *g* 0) 0 *g* 0 (makunbound '*g*) *g* *g* error: unbound variable How is this done in Python? Often it is a better choice to initialize the global with a sentinel: g = None # ... g = something meaningful # the equivalent of

Re: Python servlet for Java applet ?

2009-04-30 Thread Linuxguy123
On Wed, 2009-04-29 at 15:37 +0200, Marco Bizzarri wrote: On Wed, Apr 29, 2009 at 3:14 PM, Linuxguy123 linuxguy...@gmail.com wrote: How does one connect the servlet to the applet ? Does anyone know of an example program that demonstrates a Python servlet with a Java applet ? Thanks !

Saturday May 2 - Python @ Global FSW Conference via VOIP - BerkeleyTIP - 21 Videos - For forwarding

2009-04-30 Thread john_re
Python 2.6 3.0 Compatibility, from PyCon 2009 == Join with the friendly productive Global FreeSW HW Culture community, in the TWICE monthly, Voice over internet Global Conference: BerkeleyTIP-Global: GNU(Linux), BSD, All Free SW, HW, Culture TIP = Talks, Installfest,

ANN: python-ldap-2.3.8

2009-04-30 Thread Michael Ströder
Find a new release of python-ldap: http://www.python-ldap.org/ python-ldap provides an object-oriented API to access LDAP directory servers from Python programs. It mainly wraps the OpenLDAP 2.x libs for that purpose. Additionally it contains modules for other LDAP-related stuff (e.g.

Replacing files in a zip archive

2009-04-30 Thread Дамјан Георгиевски
I'm writing a script that should modify ODF files. ODF files are just .zip archives with some .xml files, images etc. So far I open the zip file and play with the xml with lxml.etree, but I can't replace the files in it. Is there some recipe that does this ? -- дамјан (

Re: Dictionary, integer compression

2009-04-30 Thread dineshv
Hi bearophile Thanks for that about Python3. My integers range from 0 to 9,999,999 and I have loads of them. Do you think Python3 will help? I want to do testing on my local machine with the large numbers of integers and was wondering if I can get away with an existing Python data structure or

Re: Using ascii numbers in regular expression

2009-04-30 Thread Lie Ryan
MRAB wrote: You're almost there: re.subn('\x61','b','') or better yet: re.subn(r'\x61','b','') Wouldn't that becomes a literal \x61 instead of a as it is inside raw string? -- http://mail.python.org/mailman/listinfo/python-list

Re: sorted() erraticly fails to sort string numbers

2009-04-30 Thread Lie Ryan
John Posner wrote: uuid wrote: I am at the same time impressed with the concise answer and disheartened by my inability to see this myself. My heartfelt thanks! Don't be disheartened! Many people -- myself included, absolutely! -- occasionally let a blind spot show in their messages to this

Re: Please explain this strange Python behaviour

2009-04-30 Thread John Posner
Duncan Booth wrote: Tim Chase python.l...@tim.thechases.com wrote: There _are_ cases where it's a useful behavior, but they're rare, so I don't advocate getting rid of it. But it is enough of a beginner gotcha that it really should be in the Python FAQ at www.python.org/doc/faq/general/

Re: Python servlet for Java applet ?

2009-04-30 Thread Piet van Oostrum
Linuxguy123 linuxguy...@gmail.com (L) wrote: L I thought that applets weren't allowed to access URLs directly. If they L can, this problem becomes trivial. They are allowed if the URL is on the same IP address as where the applet came from (same origin policy). But in your original post you

Re: import and package confusion

2009-04-30 Thread Dale Amon
On Thu, Apr 30, 2009 at 08:32:31AM +0200, Jeroen Ruigrok van der Werven wrote: -On [20090430 02:21], Dale Amon (a...@vnl.com) wrote: import sys sys.path.extend (['../lib', '../bin']) from VLMLegacy.CardReader import CardReader rdr = CardReader (../example/B767.dat,PRINTABLE) iotypes

Re: import and package confusion

2009-04-30 Thread Dale Amon
On Thu, Apr 30, 2009 at 02:38:03AM -0400, Dave Angel wrote: As Scott David Daniels says, you have two built-in choices, depending on Python version. If you can use __import__(), then realize that mod = __import__(WINGTL) will do an import, using a string as the import name. I don' t

Re: print(f) for files .. and is print % going away?

2009-04-30 Thread pruebauno
On Apr 30, 8:30 am, Esmail ebo...@hotmail.com wrote: Matt Nordhoff wrote: Esmail wrote: Hello all, I use the print method with % for formatting my output to the console since I am quite familiar with printf from my C days, and I like it quite well. I am wondering if there is a way

don't understand namespaces...

2009-04-30 Thread Lawrence Hanser
Dear Pythoners, I think I do not yet have a good understanding of namespaces. Here is what I have in broad outline form: import Tkinter Class App(Frame) define two frames, buttons in one and Listbox in the other Class App2(Frame) define one

Re: Using ascii numbers in regular expression

2009-04-30 Thread MRAB
Lie Ryan wrote: MRAB wrote: You're almost there: re.subn('\x61','b','') or better yet: re.subn(r'\x61','b','') Wouldn't that becomes a literal \x61 instead of a as it is inside raw string? Yes. The re module will understand the \x sequence within a regular expression.

Re: Replacing files in a zip archive

2009-04-30 Thread MRAB
Дамјан Георгиевски wrote: I'm writing a script that should modify ODF files. ODF files are just .zip archives with some .xml files, images etc. So far I open the zip file and play with the xml with lxml.etree, but I can't replace the files in it. Is there some recipe that does this ?

Re: import and package confusion

2009-04-30 Thread Dale Amon
On Thu, Apr 30, 2009 at 04:33:57AM -0300, Gabriel Genellina wrote: En Thu, 30 Apr 2009 03:04:40 -0300, alex23 wuwe...@gmail.com escribió: Are you familiar with __import__? iotypes = [WINGTL,VLMPC,VLM4997] for iotype in iotypes: packagename = VLMLegacy. + iotype + .Conditions classname

Re: Please explain this strange Python behaviour

2009-04-30 Thread Stephen Hansen
* This writeup, and the virtually identical one at effbot.org that Diez referenced, address the *what* of default arguments, but don't really address the *why*, beyond the statement that Default values are created exactly once, when the function is defined (by executing the *def*

Re: import and package confusion

2009-04-30 Thread MRAB
Dale Amon wrote: On Thu, Apr 30, 2009 at 08:32:31AM +0200, Jeroen Ruigrok van der Werven wrote: -On [20090430 02:21], Dale Amon (a...@vnl.com) wrote: import sys sys.path.extend (['../lib', '../bin']) from VLMLegacy.CardReader import CardReader rdr = CardReader (../example/B767.dat,PRINTABLE

Re: import and package confusion

2009-04-30 Thread Dale Amon
Gabriel gave me the key to a fine solution, so just to put a bow tie on this thread: #!/usr/bin/python import sys sys.path.extend (['../lib', '../bin']) from VLMLegacy.CardReader import CardReader rdr = CardReader (../example/B767.dat,PRINTABLE) iotypes = [WINGTL,VLMPC,VLM4997] for iotype

Re: don't understand namespaces...

2009-04-30 Thread Mike Driscoll
On Apr 30, 9:11 am, Lawrence Hanser lhan...@gmail.com wrote: Dear Pythoners, I think I do not yet have a good understanding of namespaces.  Here is what I have in broad outline form: import Tkinter Class App(Frame)       define two frames, buttons in

Re: Installing Python 2.5.4 from Source under Windows

2009-04-30 Thread Jim Carlock
Paul Franz wrote... : I have looked and looked and looked. But I can not find directions : on installing the version of Python built using Microsoft's : compiler. It builds. I get the dlls and the exe's. But there is no : documentation that says how to install what has been built. I have : read

decode command line parameters - recomendend way

2009-04-30 Thread Jax
Hello I want add full Unicode support in my scripts. Now I have encoutered theoretical problem with command line parameters. I can't find anything in that mater. But I develop solution which seems to work. Question is: Is it recommendend way to decode command line parameters: lFileConfig = None

Re: ctypes

2009-04-30 Thread Stefan Behnel
luca72 wrote: [3x the same thing] You should learn to calm down and wait for an answer. Even if the problem is urgent for you, it may not be to everyone, and spamming a newsgroup will not help to get people in a friendly mood to write a helpful reply. This is always worth a read:

Re: Python 2.6 Install on OSX Server 10.5: lWhich flag to use in configure to Change the Install location?

2009-04-30 Thread Piet van Oostrum
Omita hays.cl...@gmail.com (O) wrote: O Long story short... I am installing Python 2.6 on OSX Server. By O default the Python.framework is installing in /Library: O /Library/Frameworks/Python.framework O However, as I am using OSX Server I would ideally like the install O location to be here:

Re: sorted() erraticly fails to sort string numbers

2009-04-30 Thread Paddy O'Loughlin
2009/4/30 Lie Ryan lie.1...@gmail.com container[:] = sorted(container, key=getkey) is equivalent to: container.sort(key=getkey) Equivalent, and in fact better since the sorting is done in-place instead of creating a new list, then overwriting the old one. Not when, as pointed

Re: What do you think of ShowMeDo

2009-04-30 Thread Peter Pearson
On Wed, 29 Apr 2009 20:13:32 -0400, David Robinow drobi...@gmail.com wrote: On Wed, Apr 29, 2009 at 9:29 AM, ky...@showmedo.com wrote: ... To reiterate, I responded to this thread because I think Ben's posting gave an unfair impression of the site and i felt the need to address some

Re: print(f) for files .. and is print % going away?

2009-04-30 Thread Lie Ryan
Esmail wrote: Hello all, I use the print method with % for formatting my output to the console since I am quite familiar with printf from my C days, and I like it quite well. There has never been print-with-formatting in python, what we have is the % string substitution operator, which is a

Re: Re: Please explain this strange Python behaviour

2009-04-30 Thread John Posner
Stephen Hansen wrote: I have a feeling this might start one of those uber-massive pass by value / reference / name / object / AIEE threads where everyone goes around in massive circles explaining how Python uses one or another parameter passing paradigm and why everyone else is wrong... but...

Re: ctypes

2009-04-30 Thread Aahz
In article gtbeld$cg...@lust.ihug.co.nz, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: -- Lawrence Death To Wildcard Imports D'Oliveiro +1 QOTW -- Aahz (a...@pythoncraft.com) * http://www.pythoncraft.com/ If you think it's expensive to hire a professional to

Re: decode command line parameters - recomendend way

2009-04-30 Thread Martin v. Löwis
I want add full Unicode support in my scripts. Now I have encoutered theoretical problem with command line parameters. I can't find anything in that mater. But I develop solution which seems to work. Question is: Is it recommendend way to decode command line parameters: lFileConfig = None

Re: Python Noob - a couple questions involving a web app

2009-04-30 Thread Carl Banks
On Apr 28, 1:47 pm, Kyle T. Jones serious...@youvegottabekidding.net wrote: Been programming for a long time, but just starting out with Python. Not a professional programmer, just that guy in one of those organizations that won't hire a pro, instead saying Hey, Kyle knows computer stuff -

string processing question

2009-04-30 Thread Kurt Mueller
Hi, on a Linux system and python 2.5.1 I have the following behaviour which I do not understand: case 1 python -c 'a=ä; print a ; print a.center(6,-) ; b=unicode(a, utf8); print b.center(6,-)' ä --ä-- --ä--- case 2 - an UnicodeEncodeError in this case: python -c 'a=ä; print a ;

Re: Geohashing

2009-04-30 Thread norseman
Marco Mariani wrote: norseman wrote: The posting needs (its creation) ... DATE. ... The code needs to state OS and program and version used to write it. And from there - user beware. Which would reduce the confusion greatly. I got the same error message and decided it was from an

Re: Replacing files in a zip archive

2009-04-30 Thread Scott David Daniels
MRAB wrote: Дамјан Георгиевски wrote: I'm writing a script that should modify ODF files. ODF files are just .zip archives with some .xml files, images etc. So far I open the zip file and play with the xml with lxml.etree, but I can't replace the files in it. Is there some recipe that does

Re: string processing question

2009-04-30 Thread Paul McGuire
On Apr 30, 11:55 am, Kurt Mueller m...@problemlos.ch wrote: Hi, on a Linux system and python 2.5.1 I have the following behaviour which I do not understand: case 1 python -c 'a=ä; print a ; print a.center(6,-) ; b=unicode(a, utf8); print b.center(6,-)' ä --ä-- --ä--- Weird. What

Re: What do you think of ShowMeDo

2009-04-30 Thread Jim Carlock
Astley Le Jasper wrote... : Gosh ... it's all gone quite busy about logging in, gui : etc. Certainly, I would try to make it clearer what is : free and what isn't. Problems with their website probably means more problems to come... 1) The website does not fit on one page. 2) It's a lot of yack

using zip() and dictionaries

2009-04-30 Thread Sneaky Wombat
I'm really confused by what is happening here. If I use zip(), I can't update individual dictionary elements like I usually do. It updates all of the dictionary elements. It's hard to explain, so here is some output from an interactive session: In [52]: header=['a','b','c','d'] In [53]:

Re: string processing question

2009-04-30 Thread norseman
Kurt Mueller wrote: Hi, on a Linux system and python 2.5.1 I have the following behaviour which I do not understand: case 1 python -c 'a=ä; print a ; print a.center(6,-) ; b=unicode(a, utf8); print b.center(6,-)' ä --ä-- --ä--- case 2 - an UnicodeEncodeError in this case: python

Re: Measure the memory cost in Python

2009-04-30 Thread Gabriel Genellina
En Thu, 30 Apr 2009 08:00:07 -0300, Li Wang li.wan...@gmail.com escribió: I want to measure the actual memory cost of a particular step in my program (Python program), does anyone know if there is some function in Python could help me to do this job? Or should I seek other tools to help me?

Re: Which flag to use in configure to Change the Install location?

2009-04-30 Thread Piet van Oostrum
Omita hays.cl...@gmail.com (O) wrote: O Long story short... I am installing Python 2.6 on OSX. By default the O Library is installing here: O /Library/Frameworks/Python.framework O However, as I am using OSX Server I would ideally like the location to O be here: O

Re: using zip() and dictionaries

2009-04-30 Thread Sneaky Wombat
quick update, #change this line: for (k,v) in zip(header,[[]]*len(header)): #to this line: for (k,v) in zip(header,[[],[],[],[]]): and it works as expected. Something about the [[]]*len(header) is causing the weird behavior. I'm probably using it wrong, but if anyone can explain why that would

Re: using zip() and dictionaries

2009-04-30 Thread Chris Rebert
On Apr 30, 12:45 pm, Sneaky Wombat wrote: I'm really confused by what is happening here.  If I use zip(), I can't update individual dictionary elements like I usually do.  It updates all of the dictionary elements.  It's hard to explain, so here is some output from an interactive session:

Re: using zip() and dictionaries

2009-04-30 Thread Sneaky Wombat
quick update, #change this line: for (k,v) in zip(header,[[]]*len(header)): #to this line: for (k,v) in zip(header,[[],[],[],[]]): and it works as expected. Something about the [[]]*len(header) is causing the weird behavior. I'm probably using it wrong, but if anyone can explain why that would

Is there any way this queue read can possibly block?

2009-04-30 Thread John Nagle
def draininput(self) : # consume any queued input try: while True : ch = self.inqueue.get_nowait() # get input, if any except Queue.Empty: # if empty return # done self.inqueue is a Queue object.

Re: suggestion on a complicated inter-process communication

2009-04-30 Thread norseman
Aaron Brady wrote: Um, that's the limit of what I'm familiar with, I'm afraid. I'd have to experiment. On Apr 28, 10:44 am, Way csw...@gmail.com wrote: Thanks a lot for the reply. I am not familiar with multi-process in Python. I am now using something like: snip However, in this case,

Re: string processing question

2009-04-30 Thread Scott David Daniels
Kurt Mueller wrote: on a Linux system and python 2.5.1 I have the following behaviour which I do not understand: case 1 python -c 'a=ä; print a ; print a.center(6,-) ; b=unicode(a, utf8); print b.center(6,-)' ä --ä-- --ä--- To discover what is happening, try something like: python -c

Re: using zip() and dictionaries

2009-04-30 Thread Sneaky Wombat
Thanks! That certainly explains it. This works as expected. columnMap={} for (k,v) in zip(header,[[] for i in range(len(header))]): #print %s,%s%(k,v) columnMap[k] = v columnMap['a'].append('test') (sorry about the double post, accidental browser refresh) On Apr 30, 1:09 pm, Chris

Re: using zip() and dictionaries

2009-04-30 Thread Scott David Daniels
Sneaky Wombat wrote: quick update, #change this line: for (k,v) in zip(header,[[]]*len(header)): #to this line: for (k,v) in zip(header,[[],[],[],[]]): and it works as expected. Something about the [[]]*len(header) is causing the weird behavior. I'm probably using it wrong, but if anyone can

urlgrabber for Python 3.0

2009-04-30 Thread Robert Dailey
urlgrabber 3.1.0 currently does not support Python 3.0. Is there a version out there that does support this? Perhaps Python 3.0 now has built in support for this? Could someone provide some guidance here? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: using zip() and dictionaries

2009-04-30 Thread Arnaud Delobelle
Sneaky Wombat joe.hr...@gmail.com writes: I'm really confused by what is happening here. If I use zip(), I can't update individual dictionary elements like I usually do. It updates all of the dictionary elements. It's hard to explain, so here is some output from an interactive session:

Re: wxPython menu creation refactoring

2009-04-30 Thread alex
Good evening Nick Thank you for answer I will study your code and learn from it. I subscribed to the wxPython users mailing list which is for my actual questions probably the more accurate place. But I always apreciate that when I post even a probably simple question I always get an answer from

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-30 Thread Barry Scott
On 30 Apr 2009, at 05:52, Martin v. Löwis wrote: How do get a printable unicode version of these path strings if they contain none unicode data? Define printable. One way would be to use a regular expression, replacing all codes in a certain range with a question mark. What I mean by

Re: using zip() and dictionaries

2009-04-30 Thread Simon Forman
On Apr 30, 2:00 pm, Sneaky Wombat joe.hr...@gmail.com wrote: quick update, #change this line: for (k,v) in zip(header,[[]]*len(header)): #to this line: for (k,v) in zip(header,[[],[],[],[]]): and it works as expected.  Something about the [[]]*len(header) is causing the weird behavior.  

Re: [Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

2009-04-30 Thread Martin v. Löwis
How do get a printable unicode version of these path strings if they contain none unicode data? Define printable. One way would be to use a regular expression, replacing all codes in a certain range with a question mark. What I mean by printable is that the string must be valid unicode

  1   2   >