Re: How to convert latex-based docs written with Python 2.5 to 2.6 framework

2008-03-27 Thread Waldemar Osuch
On Mar 26, 1:37 pm, Michael Ströder <[EMAIL PROTECTED]> wrote: > HI! > > I had a look on how Doc/ is organized with Python 2.6. There are files with > suffix .rst. Hmm... > > I'm maintaing existing docs for python-ldap which I might have to convert to > the new concept in the long run. What's the r

Re: counting using variable length string as base

2008-03-27 Thread Grimsqueaker
That seems to give me the items in the list back in an iterator. Am I using it incorrectly? -- http://mail.python.org/mailman/listinfo/python-list

Re: counting using variable length string as base

2008-03-27 Thread castironpi
On Mar 27, 2:33 am, Grimsqueaker <[EMAIL PROTECTED]> wrote: > That seems to give me the items in the list back in an iterator. Am I > using it incorrectly? Use list( it ). -- http://mail.python.org/mailman/listinfo/python-list

Re: what does ^ do in python

2008-03-27 Thread Steven D'Aprano
On Wed, 26 Mar 2008 19:45:34 +0100, Heiko Wundram wrote: > Am Mittwoch, 26. März 2008 19:04:44 schrieb David Anderson: >> HOw can we use express pointers as in C or python? > > There's no such thing as a pointer in Python, so you can't "express" > them either. Was this what you were trying to ask

do 'os.path' include 'os' for us?

2008-03-27 Thread Jerry Fleming
Hi, I wrote a python script to list files in a directory but somehow did it wrongly by importing os.path instead of os. To my astonishment, it works just as charm: #!/usr/bin/python import os.path for file in os.listdir('/root/'): print file I was wondering why? os.path doesn't contain

Re: counting using variable length string as base

2008-03-27 Thread Diez B. Roggisch
Grimsqueaker schrieb: > That seems to give me the items in the list back in an iterator. Am I > using it incorrectly? No. Just put a list() around it. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: last mouse movment or keyboard hit

2008-03-27 Thread Diez B. Roggisch
Ron Eggler schrieb: > Hi, > > I would like to get the time of the most recent human activity like a cursor > movement or a key hit. > Does anyone know how I can get this back to start some action after there > has been no activity for X minutes/seconds? Try hooking yourself into the OS screen-sav

Re: do 'os.path' include 'os' for us?

2008-03-27 Thread John Machin
On Mar 27, 6:41 pm, Jerry Fleming <[EMAIL PROTECTED]> wrote: > Hi, > > I wrote a python script to list files in a directory but somehow did it > wrongly by importing os.path instead of os. To my astonishment, it works > just as charm: > #!/usr/bin/python > import os.path > for file in os.listdir('/

Re: genetic algors in practical application

2008-03-27 Thread castironpi
On Mar 26, 9:55 pm, [EMAIL PROTECTED] wrote: > I want to go in to construction.  However, 'I' means 'newsgroup' and > 'want to go' means 'is'. > > If you had an army of two-micron spiders, could we build something? > Use case is an American skyscraper. > > They have powerful tricks.  Clearly they c

Re: how to dynamically create class methods ?

2008-03-27 Thread Steven D'Aprano
On Wed, 26 Mar 2008 00:27:17 -0700, Arnaud Delobelle wrote: >> I'm hardly surprised. The naivety of those who insist that the "best >> way to understand how new.function and new.code work" is to look at the >> C source code for object is amusing. > > Since 'those who insist...' are just one perso

Re: how to dynamically create class methods ?

2008-03-27 Thread Steven D'Aprano
On Wed, 26 Mar 2008 00:55:22 -0700, Arnaud Delobelle wrote: [snip] > Except it only *appears* to work. What happens if were store the > instances in a list and then execute them all in one go? Ah yes, nicely spotted. Another solution would be to use a proper factory function: def factory(reco

Partial Function Application and implicit self problem

2008-03-27 Thread Gabriel Rossetti
Hello, I am using Partial Function Application in a class and I've come up with a problem, when the method is called it tries to pass "self" to the curried/partial function, but this should be the first argument in reality, but since the function is curried, then the self gets passed as the se

Re: Partial Function Application and implicit self problem

2008-03-27 Thread Diez B. Roggisch
Gabriel Rossetti schrieb: > Hello, > > I am using Partial Function Application in a class and I've come up with > a problem, when the method is called it tries to pass "self" to the > curried/partial function, but this should be the first argument in > reality, but since the function is curried

Re: Partial Function Application and implicit self problem

2008-03-27 Thread Gabriel Rossetti
Gabriel Rossetti wrote: > Hello, > > I am using Partial Function Application in a class and I've come up with > a problem, when the method is called it tries to pass "self" to the > curried/partial function, but this should be the first argument in > reality, but since the function is curried,

Re: Partial Function Application and implicit self problem

2008-03-27 Thread Gabriel Rossetti
Diez B. Roggisch wrote: > Gabriel Rossetti schrieb: > >> Hello, >> >> I am using Partial Function Application in a class and I've come up with >> a problem, when the method is called it tries to pass "self" to the >> curried/partial function, but this should be the first argument in >> realit

Re: counting using variable length string as base

2008-03-27 Thread Steven D'Aprano
On Thu, 27 Mar 2008 00:33:21 -0700, Grimsqueaker wrote: > That seems to give me the items in the list back in an iterator. Am I > using it incorrectly? Given an iterator, you use it like this: for item in iterator: print item # or do something else If you're sure that the iterator is relat

Re: py2exe socket.gaierror (10093)

2008-03-27 Thread Knut
On 26 Mar, 23:08, Thomas Heller <[EMAIL PROTECTED]> wrote: > Knut schrieb: > > > > >> The script can't resolve the server name. Try to do it by hand using > >> nslookup or even ping (you may want to add a few print statements inside > >> the script to see the exact host name it is trying to connect

Re: counting using variable length string as base

2008-03-27 Thread Grimsqueaker
OK, got that. If I use: for x in string_cartesian_product('abc'): print x I get: a b c What am I not understanding? Thank you -- http://mail.python.org/mailman/listinfo/python-list

Re: py2exe socket.gaierror (10093)

2008-03-27 Thread Tim Golden
Python Programming on Win32 wrote: > The problem is running smtplib in a py2exe compiled exe file. When it > tries to establish a socket to the mail server it fails. > > Just wondering someone has encountered this before, and if someone > might be able to point me in the right direction. > > Unha

Re: Py2exe embed my modules to libary.zip

2008-03-27 Thread vedrandekovic
On 26 ožu, 20:11, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 26 Mar 2008 15:38:16 -0300, Tzury Bar Yochay > <[EMAIL PROTECTED]> escribió: > > >> and then when my application execute code how can I set path to > >> d3dx module to "library.zip/d3dx.py". > >> I'm not sure is this pro

Re: counting using variable length string as base

2008-03-27 Thread Peter Otten
Grimsqueaker wrote: > That seems to give me the items in the list back in an iterator. Am I > using it incorrectly? With Dan's functions in cartesian.py you can do the following: >>> from cartesian import * >>> def count(digits): ... args = [] ... while 1: ... args.append(di

Re: Partial Function Application and implicit self problem

2008-03-27 Thread Gabriel Genellina
En Thu, 27 Mar 2008 05:40:30 -0300, Gabriel Rossetti <[EMAIL PROTECTED]> escribió: >>> if(atomic): >>># Lock the service dict and register the service, then unlock it >>>self.__mutex.lock(reg, service) >>>self.__mutex.unlock() I see that you've already solved yo

Re: Partial Function Application and implicit self problem

2008-03-27 Thread Bruno Desthuilliers
Gabriel Rossetti a écrit : > > Gabriel Rossetti wrote: >> Hello, >> >> I am using Partial Function Application in a class and I've come up >> with a problem, when the method is called it tries to pass "self" to >> the curried/partial function, but this should be the first argument in >> reality

Re: Partial Function Application and implicit self problem

2008-03-27 Thread Diez B. Roggisch
Gabriel Rossetti wrote: > > Gabriel Rossetti wrote: >> Hello, >> >> I am using Partial Function Application in a class and I've come up with >> a problem, when the method is called it tries to pass "self" to the >> curried/partial function, but this should be the first argument in >> reality, but

Re: A question on decorators

2008-03-27 Thread Bruno Desthuilliers
Tim Henderson a écrit : > Hello > > I am writing an application that has a mysql back end and I have this > idea to simplify my life when accessing the database. The idea is to > wrap the all the functions dealing with a particular row in a > particular in a particular table inside a class. So if

Re: Py2exe embed my modules to libary.zip

2008-03-27 Thread Gabriel Genellina
En Thu, 27 Mar 2008 06:00:26 -0300, <[EMAIL PROTECTED]> escribió: > I was add this into my application code: > > import sys > import os > my_dir=os.getcwd() > sys.path.append(my_dir) > sys.path.append(my_dir+"\\libary.zip") > sys.path.append(my_dir+"\\libary.zip\\py2exe") # PY2EXE is folder > f=op

Re: subtract dates with time module

2008-03-27 Thread Diez B. Roggisch
barronmo wrote: > I'm trying to get the difference in dates using the time module rather > than datetime because I need to use strptime() to convert a date and > then find out how many weeks and days until that date. I'm a beginner > so any help would be appreciated. Here is the code: Use strpt

Re: Why does python behave so? (removing list items)

2008-03-27 Thread Bruno Desthuilliers
Thomas Dybdahl Ahle a écrit : > On Wed, 2008-03-26 at 23:04 +0100, Michał Bentkowski wrote: >> Why does python create a reference here, not just copy the variable? > > Python, like most other oo languages, will always make references for =, > unless you work on native types (numbers and strings).

Re: Partial Function Application and implicit self problem

2008-03-27 Thread Gabriel Rossetti
Bruno Desthuilliers wrote: > Gabriel Rossetti a écrit : >> Hello, >> >> I am using Partial Function Application in a class and I've come up >> with a problem, when the method is called it tries to pass "self" to >> the curried/partial function, but this should be the first argument >> in reality

Re: Print to end of line in a terminal

2008-03-27 Thread ndlarsen
Hello again. I apologize for not replying earlier but I have been swamped in work lately. I appreciate your replies. Eventually I chose using curses for "right-hand edge of the window" as it seemed to be the most suitable solution. Thank you. ndlarsen -- http://mail.python.org/mailman/listin

Re: GUI toolkits with Tkinter's .pack() alternative

2008-03-27 Thread Guilherme Polo
2008/3/27, Alex9968 <[EMAIL PROTECTED]>: > Guilherme Polo wrote: > > 2008/3/26, Alex9968 <[EMAIL PROTECTED]>: > > > >> Hi all, > >> > >> I use Tkinter's Pack widget geometry manager (I really prefer it over > >> using visual GUI designers), so my question is which other GUI toolkits > >>

Re: subtract dates with time module

2008-03-27 Thread John Machin
barronmo wrote: > I'm trying to get the difference in dates using the time module rather > than datetime because I need to use strptime() to convert a date and > then find out how many weeks and days until that date. datetime.datetime.strptime was introduced in Python 2.5; what version are you u

Re: what does ^ do in python

2008-03-27 Thread castironpi
On Mar 26, 1:36 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 26 Mar 2008 15:04:44 -0300, David Anderson <[EMAIL PROTECTED]>   > escribió: > > > HOw can we use express pointers as in C or python? > > Traceback (most recent call last): >    File "", line 1, in >    File "parser.py",

Re: GUI toolkits with Tkinter's .pack() alternative

2008-03-27 Thread Alex9968
Guilherme Polo wrote: > 2008/3/27, Alex9968 <[EMAIL PROTECTED]>: > >> Guilherme Polo wrote: >> > 2008/3/26, Alex9968 <[EMAIL PROTECTED]>: >> > >> >> Hi all, >> >> >> >> I use Tkinter's Pack widget geometry manager (I really prefer it over >> >> using visual GUI designers), so my question

Re: Partial Function Application and implicit self problem

2008-03-27 Thread Bruno Desthuilliers
Gabriel Rossetti a écrit : > Bruno Desthuilliers wrote: >> Gabriel Rossetti a écrit : (snip) >>> registerServiceAtomic = partial(__registerService, True) >>> registerServiceNonAtomic = partial(__registerService, False) >>> >>> I should pass self when applying partial, but then I can't do that >>

Re: Plugin framework - Overcomplicating things?

2008-03-27 Thread André
On Mar 27, 3:31 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 27 Mar 2008 01:50:56 -0300, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> escribió: > > > All this comes to my question - am I overcomplicating this project? I > > can understand the use of something like the trac component syst

Re: what are generators?

2008-03-27 Thread castironpi
On Mar 25, 7:36 pm, Miki <[EMAIL PROTECTED]> wrote: > On Mar 24, 8:17 am, [EMAIL PROTECTED] wrote: > > > I'm looking for a cool trick using generators.  Know any exercises I > > can work? > > Simple one the comes to mind is flattening a list: > > >>> list(flatten([1, [[2], 3], [[[4)) > [1, 2, 3

Re: Problem with write binary data to OLE field in Access

2008-03-27 Thread Tim Golden
lialie wrote: [... snip slightly confused indication that reading back a binary item using GetChunk appears to double its length ...] Well I don't know why this should be happening, but I do at least have a few suggestions: 1) Try using ADODB.Stream instead of GetChunk etc. 2) Try using the adod

Re: counting using variable length string as base

2008-03-27 Thread castironpi
On Mar 27, 4:01 am, Peter Otten <[EMAIL PROTECTED]> wrote: > Grimsqueaker wrote: > > That seems to give me the items in the list back in an iterator. Am I > > using it incorrectly? > > With Dan's functions in cartesian.py you can do the following: > > >>> from cartesian import * > >>> def count(dig

Re: GUI toolkits with Tkinter's .pack() alternative

2008-03-27 Thread Guilherme Polo
2008/3/27, Alex9968 <[EMAIL PROTECTED]>: > Guilherme Polo wrote: > > 2008/3/27, Alex9968 <[EMAIL PROTECTED]>: > > > >> Guilherme Polo wrote: > >> > 2008/3/26, Alex9968 <[EMAIL PROTECTED]>: > >> > > >> >> Hi all, > >> >> > >> >> I use Tkinter's Pack widget geometry manager (I really pr

Re: Partial Function Application and implicit self problem

2008-03-27 Thread castironpi
On Mar 27, 6:05 am, Bruno Desthuilliers wrote: > Gabriel Rossetti a écrit : > > > > > > > Bruno Desthuilliers wrote: > >> Gabriel Rossetti a écrit : > (snip) > >>>   registerServiceAtomic = partial(__registerService, True) > >>> registerServiceNonAtomic = partial(__registerService, False) > > >>>

Re: what are generators?

2008-03-27 Thread castironpi
On Mar 27, 6:19 am, [EMAIL PROTECTED] wrote: > On Mar 25, 7:36 pm, Miki <[EMAIL PROTECTED]> wrote: > > > On Mar 24, 8:17 am, [EMAIL PROTECTED] wrote: > > > > I'm looking for a cool trick using generators.  Know any exercises I > > > can work? > > > Simple one the comes to mind is flattening a list:

Psyco alternative

2008-03-27 Thread king kikapu
Hi, it seems that Psyco's author will not port it for the upcoming Python 3000 release :( So, for us who use it we will continue to use CPython 2.5.x version for some time to come. Is there an alternative to Psyco so i can have a look at ? Thanks in advance. -- http://mail.python.org/mailman/li

Re: GUI toolkits with Tkinter's .pack() alternative

2008-03-27 Thread Alex9968
Guilherme Polo wrote: > 2008/3/27, Alex9968 <[EMAIL PROTECTED]>: > >> Guilherme Polo wrote: >> > 2008/3/27, Alex9968 <[EMAIL PROTECTED]>: >> > >> >> Guilherme Polo wrote: >> >> > 2008/3/26, Alex9968 <[EMAIL PROTECTED]>: >> >> > >> >> >> Hi all, >> >> >> >> >> >> I use Tkinter's Pac

Re: GUI toolkits with Tkinter's .pack() alternative

2008-03-27 Thread Alex9968
Guilherme Polo wrote: > 2008/3/27, Alex9968 <[EMAIL PROTECTED]>: > >> Guilherme Polo wrote: >> > 2008/3/27, Alex9968 <[EMAIL PROTECTED]>: >> > >> >> Guilherme Polo wrote: >> >> > 2008/3/26, Alex9968 <[EMAIL PROTECTED]>: >> >> > >> >> >> Hi all, >> >> >> >> >> >> I use Tkinter's Pac

Re: PyGTK localisation on Win32

2008-03-27 Thread Sukhov Dmitry
> > I had no problem with using standard gettext way of doing i18n on > Windows with PyGTK an Glade, apart some quirks with LANG environment > variable. Basically, the code that works looks like this: > > import gettext, locale > locale.setlocale(locale.LC_ALL, '') > if os.name == 'nt':

Pickle: several class instance objects in one file?

2008-03-27 Thread Dominique.Holzwarth
Hi everyone I've never used the module 'pickle' so far, thus I've got some questions about how to use it: Lets say I have instances of class A and class B: a = A() b = B() Is it possible to pickle both of these instances to the same pkl-file or will that have any bad impact for unpickle (i.e.

Re: Psyco alternative

2008-03-27 Thread Paul Rubin
king kikapu <[EMAIL PROTECTED]> writes: > it seems that Psyco's author will not port it for the upcoming Python > 3000 release :( I think the idea is it will be part of PyPy and you should use that. -- http://mail.python.org/mailman/listinfo/python-list

Re: Psyco alternative

2008-03-27 Thread king kikapu
On 27 Μαρ, 14:35, Paul Rubin wrote: > king kikapu <[EMAIL PROTECTED]> writes: > > it seems that Psyco's author will not port it for the upcoming Python > > 3000 release :( > > I think the idea is it will be part of PyPy and you should use that. I know that his efforts a

Re: Pickle: several class instance objects in one file?

2008-03-27 Thread Marc 'BlackJack' Rintsch
On Thu, 27 Mar 2008 12:28:25 +, Dominique.Holzwarth wrote: > Lets say I have instances of class A and class B: > > a = A() > b = B() > > Is it possible to pickle both of these instances to the same pkl-file or > will that have any bad impact for unpickle (i.e. the instance are > 'mixed' or '

Re: Py2exe embed my modules to libary.zip

2008-03-27 Thread vedrandekovic
On 27 ožu, 10:44, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 27 Mar 2008 06:00:26 -0300, <[EMAIL PROTECTED]> escribió: > > > > > I was add this into my application code: > > > import sys > > import os > > my_dir=os.getcwd() > > sys.path.append(my_dir) > > sys.path.append(my_dir+"\\lib

Re: Psyco alternative

2008-03-27 Thread Diez B. Roggisch
king kikapu wrote: > On 27 Μαρ, 14:35, Paul Rubin wrote: >> king kikapu <[EMAIL PROTECTED]> writes: >> > it seems that Psyco's author will not port it for the upcoming Python >> > 3000 release :( >> >> I think the idea is it will be part of PyPy and you should use that.

Re: Psyco alternative

2008-03-27 Thread king kikapu
On 27 Μαρ, 15:56, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > king kikapu wrote: > > On 27 Μαρ, 14:35, Paul Rubin wrote: > >> king kikapu <[EMAIL PROTECTED]> writes: > >> > it seems that Psyco's author will not port it for the upcoming Python > >> > 3000 release :( >

Re: Psyco alternative

2008-03-27 Thread Diez B. Roggisch
> Ok, i know this. The one that i do not know, is if, let'say, in 2 > years it will be ready for seriously development, PyPy will aim to > "replace" CPython entirely ?? We are talking about an whole new > distribution ? Most certainly not. It's the goal of each language to finally become self-host

And the reverse? Does os also import os.path?

2008-03-27 Thread Wilbert Berendsen
If i do >>> import os >>> os.path.abspath("bla") '/home/wilbert/bla' >>> it seems that just import os also makes available al os.path functions. But is that always true? Thanks, Wilbert -- http://www.wilbertberendsen.nl/ "You must be the change you wish to see in the world." -- Mahatm

Checking processes running under Windows

2008-03-27 Thread João Rodrigues
Hello all! I'm trying to write a script that needs to check which processes are running under Windows (XP Pro, Home, whatever). The method I'm using is: >>> process_list = os.popen('TASKLIST').read() However, XP Home doesn't have the tasklist.exe tool so, this is kind of useless in that OS. Do yo

Regarding __slots__ and other stuff: A couple of questions

2008-03-27 Thread dave berk
I'm new to Python. I'm trying to understand the type/class/object(instance) model. I have read here: http://www.cafepy.com/article/python_types_and_objects/python_types_and_objects.html and here: http://www.cafepy.com/article/python_attributes_and_methods/python_attributes_and_methods.html as well

Re: Psyco alternative

2008-03-27 Thread king kikapu
> > > As for psyco, are there any alternatives to use now ? > > Nope, but I heard through the grapevine that while it won't be supported for > all times to come, a new version is in the making. Aha!! It seems you have better "sources" than me! :) > But ultimately, the author says that the appro

Re: Psyco alternative

2008-03-27 Thread Jean-Paul Calderone
On Thu, 27 Mar 2008 15:19:11 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> Ok, i know this. The one that i do not know, is if, let'say, in 2 >> years it will be ready for seriously development, PyPy will aim to >> "replace" CPython entirely ?? We are talking about an whole new >> distrib

Is subprocess.Popen completely broken?

2008-03-27 Thread Skip Montanaro
I am trying to replace os.system calls with subprocess.Popen. This simple example fails miserably: >>> proc = subprocess.Popen ("ls /tmp") Traceback (most recent call last): File "", line 1, in File "/home/titan/skipm/local/lib/python2.5/subprocess.py", line 594, in __init__ errread, er

Re: Psyco alternative

2008-03-27 Thread Stefan Behnel
king kikapu wrote: >>> As for psyco, are there any alternatives to use now ? >> But ultimately, the author says that the approach is flawed, so at *some* >> point it will be discontinued. But that could be said about nearly >> everything, couldn't it? >> > It is a pity because this module *does* re

Tkinter menus made easy

2008-03-27 Thread MartinRinehart
Writing Tkinter menu code used to be rather tedious, uninspiring work. I figured that I could delegate the job to a program: http://www.martinrinehart.com/articles/menus.py Run it. Then look at the source (bottom of file). There's a bit more doc in the doc comment at the top. Peer review is most

Re: Is subprocess.Popen completely broken?

2008-03-27 Thread Guilherme Polo
2008/3/27, Skip Montanaro <[EMAIL PROTECTED]>: > I am trying to replace os.system calls with subprocess.Popen. This simple > example fails miserably: > > >>> proc = subprocess.Popen ("ls /tmp") proc = subprocess.Popen ("ls /tmp", shell=True) or proc = subprocess.Popen (["ls", "/tmp"]) should

Re: Tkinter menus made easy

2008-03-27 Thread Guilherme Polo
2008/3/27, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > Writing Tkinter menu code used to be rather tedious, uninspiring work. > I figured that I could delegate the job to a program: > I didn't look at it yet, but just in case you weren't aware there is a gui designer tool for tkinter called GUI Desi

Re: Psyco alternative

2008-03-27 Thread king kikapu
> If it's about "some problems", then maybe Cython is an alternative. > > http://cython.org > > Stefan Hmmm...thanks but i think Pyrex-like solution is not the ideal one. Coming from C# and having 8 years of expertise on it, i have gain a very positive thinking about jit compilers and i think that

Tkinter Text widget

2008-03-27 Thread MartinRinehart
Is there a way of translating from the Text widget's width/height (in characters) to pixels so you can open an appropriately sized window? -- http://mail.python.org/mailman/listinfo/python-list

Re: Is subprocess.Popen completely broken?

2008-03-27 Thread Jeffrey Froman
Skip Montanaro wrote: > I am trying to replace os.system calls with subprocess.Popen.  This simple > example fails miserably: > proc = subprocess.Popen ("ls /tmp") Popen expects a list of program arguments. When passed a single string instead of a list, as in your example, it assumes that t

Re: Is subprocess.Popen completely broken?

2008-03-27 Thread Jerry Hill
On Thu, Mar 27, 2008 at 10:53 AM, Skip Montanaro <[EMAIL PROTECTED]> wrote: > I am trying to replace os.system calls with subprocess.Popen. This simple > example fails miserably: > > >>> proc = subprocess.Popen ("ls /tmp") > Traceback (most recent call last): > File "", line 1, in > File "

Re: Is subprocess.Popen completely broken?

2008-03-27 Thread Skip Montanaro
> > >>> proc = subprocess.Popen ("ls /tmp") > > proc = subprocess.Popen ("ls /tmp", shell=True) > > or > > proc = subprocess.Popen (["ls", "/tmp"]) > > should work. Why should I need to set shell=True? I'm not globbing anything. The second case still fails: >>> proc = subprocess.Popen (["/

Re: py2exe socket.gaierror (10093)

2008-03-27 Thread Knut
This is frustrating. I was working on writing a sample for my problem. I start with dissecting my code which still gives the same error. Then I start thinking that it might be my setup file doing the damage. And i start it from scratch. Everything suddenly works. Fine! i think, i will have to sta

Re: Is subprocess.Popen completely broken?

2008-03-27 Thread Jerry Hill
> Why should I need to set shell=True? I'm not globbing anything. The > second case still fails: RTFM -- http://mail.python.org/mailman/listinfo/python-list

Re: Checking processes running under Windows

2008-03-27 Thread Tim Golden
João Rodrigues wrote: > Hello all! I'm trying to write a script that needs to check which processes > are running under Windows (XP Pro, Home, whatever). The method I'm using is: > process_list = os.popen('TASKLIST').read() > > However, XP Home doesn't have the tasklist.exe tool so, this is

Re: Is subprocess.Popen completely broken?

2008-03-27 Thread Guilherme Polo
2008/3/27, Skip Montanaro <[EMAIL PROTECTED]>: > > > >>> proc = subprocess.Popen ("ls /tmp") > > > > proc = subprocess.Popen ("ls /tmp", shell=True) > > > > or > > > > proc = subprocess.Popen (["ls", "/tmp"]) > > > > should work. > > > Why should I need to set shell=True? The default is s

Re: Checking processes running under Windows

2008-03-27 Thread Shane Geiger
One way: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303339 Another way: wmi # List all running processes # http://tgolden.sc.sabren.com/python/wmi_cookbook.html#running_processes import wmi c = wmi.WMI () for process in c.Win32_Process (): print process.ProcessId, process.Name

Re: Is subprocess.Popen completely broken?

2008-03-27 Thread Skip Montanaro
Jerry Hill gmail.com> writes: > It's looking for an executable named "ls /tmp" Since it can't find > one, it raises an exception. > > If you just want to replace an os.system call, you need to pass > shell=True to Popen, like this: > proc = subprocess.Popen("ls /tmp", shell=True) > > That will

Re: Is subprocess.Popen completely broken?

2008-03-27 Thread Lee Capps
On Mar 27, 2008, at 10:53 AM, Skip Montanaro wrote: > I am trying to replace os.system calls with subprocess.Popen. This > simple > example fails miserably: > proc = subprocess.Popen ("ls /tmp") > Traceback (most recent call last): > File "", line 1, in > File "/home/titan/skipm/loca

Pystemmer 1.0.1 installation problem in Linux

2008-03-27 Thread mungkol
Dear all, I am a newbie to Python community. For my project, I tried to install Pystemmer 1.0.1 (http://snowball.tartarus.org/wrappers/ PyStemmer-1.0.1.tar.gz) on my linux ubuntu 7.10 machine but unsuccessful. It produced the following error: running install running build running build_ext buildi

Re: Is subprocess.Popen completely broken?

2008-03-27 Thread Gary Herron
Skip Montanaro wrote: >>> >>> proc = subprocess.Popen ("ls /tmp") >>> >> proc = subprocess.Popen ("ls /tmp", shell=True) >> >> or >> >> proc = subprocess.Popen (["ls", "/tmp"]) >> >> should work. >> > > Why should I need to set shell=True? I'm not globbing anything. The > second case

Re: Is subprocess.Popen completely broken?

2008-03-27 Thread skip
>> Why should I need to set shell=True? I'm not globbing anything. The >> second case still fails: Jerry> RTFM Thank you. I had. The bits about the type of the args parameter don't mention the shell parameter or that there was any difference between using strings or lists. I mis

Re: Line segments, overlap, and bits

2008-03-27 Thread Istvan Albert
On Mar 26, 5:28 pm, Sean Davis <[EMAIL PROTECTED]> wrote: > I am working with genomic data. Basically, it consists of many tuples > of (start,end) on a line. I would like to convert these tuples of > (start,end) to a string of bits where a bit is 1 if it is covered by > any of the regions describ

Re: Tkinter menus made easy

2008-03-27 Thread bearophileHUGS
On Mar 27, 3:54 pm, [EMAIL PROTECTED] wrote: > Writing Tkinter menu code used to be rather tedious, uninspiring work. > I figured that I could delegate the job to a program: I did develop a proggy that takes the following as input, it's part of my "agui" project, you can use it as an idea to impro

Re: Psyco alternative

2008-03-27 Thread bearophileHUGS
Diez B. Roggisch: > the author says that the approach is flawed, so at *some* > point it will be discontinued. Can't Psyco be improved, so it can compile things like: nums = (i for i in xrange(20) if i % 2) print sum(nums) I think the current Psyco runs slower than Python with generators/ it

dynimac code with lambda function creation

2008-03-27 Thread Justin Delegard
So I am trying to pass an object's method call to a function that requires a function pointer. I figured an easy way to do it would be to create a lambda function that calls the correct method, but this is proving more difficult than I imagined. Here is the function I'm using: def objectMetho

Re: Psyco alternative

2008-03-27 Thread Jean-Paul Calderone
On Thu, 27 Mar 2008 08:59:33 -0700 (PDT), [EMAIL PROTECTED] wrote: >Diez B. Roggisch: >> the author says that the approach is flawed, so at *some* >> point it will be discontinued. > >Can't Psyco be improved, so it can compile things like: > >nums = (i for i in xrange(20) if i % 2) >print sum(n

Dynamic code problem

2008-03-27 Thread perlefenc
My dynamic code failed at this site http://playwide1.extra.hu/, need some help thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Psyco alternative

2008-03-27 Thread king kikapu
> One reason attention is going to PyPy instead of Psyco... > > Jean-Paul I had a look at PyPy, it, indeed, have a very long way to go so we can consider it an alternative. -- http://mail.python.org/mailman/listinfo/python-list

Re: dynimac code with lambda function creation

2008-03-27 Thread Laszlo Nagy
Justin Delegard wrote: > So I am trying to pass an object's method call to a function that > requires a function pointer. I figured an easy way to do it would be to > create a lambda function that calls the correct method, but this is > proving more difficult than I imagined. > > Here is the fu

Re: first interactive app

2008-03-27 Thread Tim Arnold
"Miki" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello Tim, >> >> Any ideas on a simple interface for this? >> > How about something like: > > Chapter 1 (001-200 200) > Chapter 2 (200-300 100) > -- 001-300 300 > Chapter 3 (300-450 150) > Chapter 4 (450-500 50) >

Re: dynimac code with lambda function creation

2008-03-27 Thread Bruno Desthuilliers
Justin Delegard a écrit : > So I am trying to pass an object's method call I assume you mean "to pass an object's method", since I don't get what passing "an object's method call" could mean. > to a function that > requires a function pointer. s/pointer/object/ There's nothing like a pointer

singleton decorator

2008-03-27 Thread r . grimm
Hallo, playing with the decorators from PEP 318 I found the elegant singleton decorator. def singleton(cls): instances = {} def getinstance(): if cls not in instances: instances[cls] = cls() return instances[cls] return getinstance @singleton class A: pass

Re: singleton decorator

2008-03-27 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hallo, > playing with the decorators from PEP 318 I found the elegant singleton > decorator. > > def singleton(cls): > instances = {} > def getinstance(): > if cls not in instances: > instances[cls] = cls() > return instances[cls] >

Re: And the reverse? Does os also import os.path?

2008-03-27 Thread Bruno Desthuilliers
Wilbert Berendsen a écrit : > If i do > import os os.path.abspath("bla") > '/home/wilbert/bla' > > it seems that just import os also makes available al os.path functions. > > But is that always true? Nope. Not all packages expose their sub-packages. -- http://mail.python.org/mailman

Re: "Soup Strainer" for ElementSoup?

2008-03-27 Thread Stefan Behnel
erikcw wrote: > I'm parsing real-world HTML with BeautifulSoup and XML with > cElementTree. > > I'm guessing that the only benefit to using ElementSoup is that I'll > have one less API to keep track of, right? If your "real-world" HTML is still somewhat close to HTML, lxml.html might be an option

Re: Py2exe embed my modules to libary.zip

2008-03-27 Thread Larry Bates
Create your py2exe distribution without a zipfile and all the modules will just be put into the installation directory. Use Inno Setup to make a proper installer for your application. -Larry On Thu, 2008-03-27 at 06:44 -0700, [EMAIL PROTECTED] wrote: > On 27 ožu, 10:44, "Gabriel Genellina" <[EMA

Set sys.stdout.encoding to utf8 in emacs/python-mode?

2008-03-27 Thread damonwischik
I use emacs 22 and python-mode. Emacs can display utf8 characters (e.g. when I open a utf8-encoded file with Chinese, those characters show up fine), and I'd like to see utf8-encoded output from my python session. >From googling, I've found references to * locale.getdefaultlocale(), which is ('en_

Re: Pystemmer 1.0.1 installation problem in Linux

2008-03-27 Thread Miki
Hello Supheakmungkol, > I am a newbie to Python community. For my project, I tried to install > Pystemmer 1.0.1 (http://snowball.tartarus.org/wrappers/ > PyStemmer-1.0.1.tar.gz) on my linux ubuntu 7.10 machine but > unsuccessful. It produced the following error: > > running install > running build

ctypes and gmp

2008-03-27 Thread Miki
Hello All, Playing around with ctypes, I'm try to use gmp (gmpy is excellent but I want to learn ctypes). I'm running: #!/usr/bin/env python from ctypes import * class mpz(Structure): _fields_ = [ ("_mp_alloc", c_int), ("_mp_size", c_int), ("_mp_d", POINTER(c_uint))

Re: Pystemmer 1.0.1 installation problem in Linux

2008-03-27 Thread Jason Scheirer
On Mar 27, 8:40 am, mungkol <[EMAIL PROTECTED]> wrote: > Dear all, > > I am a newbie to Python community. For my project, I tried to install > Pystemmer 1.0.1 (http://snowball.tartarus.org/wrappers/ > PyStemmer-1.0.1.tar.gz) on my linux ubuntu 7.10 machine but > unsuccessful. It produced the follow

Re: SoC project: Python-Haskell bridge - request for feedback

2008-03-27 Thread Joshua Kugler
Micha? Janeczek wrote: > Hi, > > I am a student interested in participating in this year's SoC. > At http://tsk.ch.uj.edu.pl/~janeczek/socapp.html (and also below > in this email) you can find a draft of my project proposal. > > I'd like to ask you to comment on it, especially the deliverables >

Re: Tkinter menus made easy

2008-03-27 Thread MartinRinehart
Guilherme Polo wrote: > there is a > gui designer tool for tkinter called GUI Designer (what a bad name), > which used to be called SpecTcl, where you can design the menus and it > then converts to python code. I tried it. after about 10 minutes I was as far as "help not found." Is anyone out t

  1   2   >